1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +00:00

Implement argc/argv support for spawned tasks.

Celebrate the new functionality with a simple /bin/cat implementation. :^)
This commit is contained in:
Andreas Kling 2018-10-26 11:16:56 +02:00
parent 53abfa7ea1
commit df87dda63c
13 changed files with 105 additions and 17 deletions

View file

@ -8,9 +8,12 @@ extern "C" int _start()
{
errno = 0;
// FIXME: Pass appropriate argc/argv.
int status = main(0, nullptr);
int argc;
char** argv;
int rc = Syscall::invoke(Syscall::GetArguments, (dword)&argc, (dword)&argv);
int status = 254;
if (rc == 0)
status = main(argc, argv);
Syscall::invoke(Syscall::PosixExit, status);
// Birger's birthday <3

View file

@ -4,9 +4,9 @@
extern "C" {
int spawn(const char* path)
int spawn(const char* path, const char** args)
{
int rc = Syscall::invoke(Syscall::Spawn, (dword)path);
int rc = Syscall::invoke(Syscall::Spawn, (dword)path, (dword)args);
__RETURN_WITH_ERRNO(rc, rc, -1);
}

View file

@ -2,7 +2,7 @@
extern "C" {
int spawn(const char* path);
int spawn(const char* path, const char** args);
}