add the support of the system call "execve" in our libgloss

This commit is contained in:
Stefan Lankes 2011-03-03 09:47:14 +01:00
parent 464f31a53b
commit e9e2a0bd01
3 changed files with 12 additions and 2 deletions

View file

@ -40,6 +40,7 @@ extern "C" {
#define __NR_sbrk 11
#define __NR_fork 12
#define __NR_wait 13
#define __NR_execve 14
#ifdef __cplusplus
}

View file

@ -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;
}

View file

@ -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) " "