add in libgloss the support of the system calls "read" and "wait"

This commit is contained in:
Stefan Lankes 2011-03-02 06:31:14 +01:00
parent cf078ec359
commit e5031e872e
3 changed files with 22 additions and 5 deletions

View file

@ -24,6 +24,7 @@
#undef errno
extern int errno;
#include "warning.h"
#include "syscall.h"
int
_DEFUN (_read, (file, ptr, len),
@ -31,5 +32,13 @@ _DEFUN (_read, (file, ptr, len),
char *ptr _AND
int len)
{
return 0;
int ret;
ret = SYSCALL3(__NR_read, file, ptr, len);
if (ret < 0) {
errno = -ret;
ret = -1;
}
return ret;
}

View file

@ -36,6 +36,7 @@ extern "C" {
#define __NR_fstat 10
#define __NR_sbrk 11
#define __NR_fork 12
#define __NR_wait 13
#define _STR(token) #token
#define _SYSCALLSTR(x) "int $" _STR(x) " "

View file

@ -23,14 +23,21 @@
#include <errno.h>
#undef errno
extern int errno;
#include "syscall.h"
#include "warning.h"
int
_DEFUN (_wait, (status),
int *status)
{
errno = ENOSYS;
return -1;
}
int ret;
stub_warning(_wait)
/* create a child process */
ret = SYSCALL1(__NR_wait, status);
if (ret < 0) {
errno = -ret;
ret = -1;
}
return ret;
}