add the support of the system call "execve" in our libgloss
This commit is contained in:
parent
464f31a53b
commit
e9e2a0bd01
3 changed files with 12 additions and 2 deletions
|
@ -40,6 +40,7 @@ extern "C" {
|
|||
#define __NR_sbrk 11
|
||||
#define __NR_fork 12
|
||||
#define __NR_wait 13
|
||||
#define __NR_execve 14
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
#include "syscall.h"
|
||||
|
||||
int
|
||||
_DEFUN (_execve, (name, argv, env),
|
||||
|
@ -31,6 +32,13 @@ _DEFUN (_execve, (name, argv, env),
|
|||
char **argv _AND
|
||||
char **env)
|
||||
{
|
||||
errno=ENOMEM;
|
||||
return -1;
|
||||
int ret;
|
||||
|
||||
ret = SYSCALL3(__NR_execve, name, argv, env);
|
||||
if (ret < 0) {
|
||||
errno = -ret;
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ extern "C" {
|
|||
#define __NR_sbrk 11
|
||||
#define __NR_fork 12
|
||||
#define __NR_wait 13
|
||||
#define __NR_execve 14
|
||||
|
||||
#define _STR(token) #token
|
||||
#define _SYSCALLSTR(x) "int $" _STR(x) " "
|
||||
|
|
Loading…
Add table
Reference in a new issue