This commit is contained in:
parent
a4ac3c85ed
commit
e664af4c2b
@ -38,5 +38,5 @@ int main()
|
||||
fprintf(stderr, "init is running as PID %d\n", getpid());
|
||||
|
||||
char* argv[] = { "/bin/hello", "--help", NULL };
|
||||
syscall(SYS_exec, "/bin/hello", argv);
|
||||
execv("/bin/hello", argv);
|
||||
}
|
||||
|
@ -23,7 +23,9 @@ extern "C"
|
||||
/* Return the current process' process ID. */
|
||||
pid_t getpid(void);
|
||||
|
||||
int execv(const char*, char* const*);
|
||||
/* Replace the current process with another one. On success, does not return. */
|
||||
int execv(const char* path, char* const* argv);
|
||||
|
||||
int execve(const char*, char* const*, char* const*);
|
||||
int execvp(const char*, char* const*);
|
||||
|
||||
|
@ -13,6 +13,12 @@ extern "C"
|
||||
return (pid_t)syscall(SYS_getpid);
|
||||
}
|
||||
|
||||
int execv(const char* path, char* const* argv)
|
||||
{
|
||||
long rc = syscall(SYS_exec, path, argv);
|
||||
__errno_return(rc, int);
|
||||
}
|
||||
|
||||
long syscall(long num, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
Loading…
Reference in New Issue
Block a user