cpu/native: add some syscall wrappers
Add wrappers for chdir, setsid, and umask.
This commit is contained in:
parent
ccd3db6ae8
commit
9a130e2e84
@ -46,6 +46,7 @@
|
||||
#include <ifaddrs.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "kernel_types.h"
|
||||
|
||||
@ -91,6 +92,7 @@ extern void (*real_srandom)(unsigned int seed);
|
||||
extern int (*real_accept)(int socket, ...);
|
||||
/* The ... is a hack to save includes: */
|
||||
extern int (*real_bind)(int socket, ...);
|
||||
extern int (*real_chdir)(const char *path);
|
||||
extern int (*real_close)(int);
|
||||
/* The ... is a hack to save includes: */
|
||||
extern int (*real_creat)(const char *path, ...);
|
||||
@ -112,6 +114,7 @@ extern int (*real_pipe)(int[2]);
|
||||
extern int (*real_select)(int nfds, ...);
|
||||
extern int (*real_setitimer)(int which, const struct itimerval
|
||||
*__restrict value, struct itimerval *__restrict ovalue);
|
||||
extern int (*real_setsid)(void);
|
||||
extern int (*real_setsockopt)(int socket, ...);
|
||||
extern int (*real_socket)(int domain, int type, int protocol);
|
||||
extern int (*real_printf)(const char *format, ...);
|
||||
@ -119,6 +122,7 @@ extern int (*real_unlink)(const char *);
|
||||
extern long int (*real_random)(void);
|
||||
extern const char* (*real_gai_strerror)(int errcode);
|
||||
extern FILE* (*real_fopen)(const char *path, const char *mode);
|
||||
extern mode_t (*real_umask)(mode_t cmask);
|
||||
|
||||
#ifdef __MACH__
|
||||
#else
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <ifaddrs.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "kernel.h"
|
||||
#include "cpu.h"
|
||||
@ -66,6 +67,7 @@ int (*real_printf)(const char *format, ...);
|
||||
int (*real_getaddrinfo)(const char *node, ...);
|
||||
int (*real_getifaddrs)(struct ifaddrs **ifap);
|
||||
int (*real_getpid)(void);
|
||||
int (*real_chdir)(const char *path);
|
||||
int (*real_close)(int);
|
||||
int (*real_creat)(const char *path, ...);
|
||||
int (*real_dup2)(int, int);
|
||||
@ -81,12 +83,14 @@ int (*real_pipe)(int[2]);
|
||||
int (*real_select)(int nfds, ...);
|
||||
int (*real_setitimer)(int which, const struct itimerval
|
||||
*restrict value, struct itimerval *restrict ovalue);
|
||||
int (*real_setsid)(void);
|
||||
int (*real_setsockopt)(int socket, ...);
|
||||
int (*real_socket)(int domain, int type, int protocol);
|
||||
int (*real_unlink)(const char *);
|
||||
long int (*real_random)(void);
|
||||
const char* (*real_gai_strerror)(int errcode);
|
||||
FILE* (*real_fopen)(const char *path, const char *mode);
|
||||
mode_t (*real_umask)(mode_t cmask);
|
||||
|
||||
#ifdef __MACH__
|
||||
#else
|
||||
@ -393,12 +397,14 @@ void _native_init_syscalls(void)
|
||||
*(void **)(&real_getifaddrs) = dlsym(RTLD_NEXT, "getifaddrs");
|
||||
*(void **)(&real_getpid) = dlsym(RTLD_NEXT, "getpid");
|
||||
*(void **)(&real_pipe) = dlsym(RTLD_NEXT, "pipe");
|
||||
*(void **)(&real_chdir) = dlsym(RTLD_NEXT, "chdir");
|
||||
*(void **)(&real_close) = dlsym(RTLD_NEXT, "close");
|
||||
*(void **)(&real_creat) = dlsym(RTLD_NEXT, "creat");
|
||||
*(void **)(&real_fork) = dlsym(RTLD_NEXT, "fork");
|
||||
*(void **)(&real_dup2) = dlsym(RTLD_NEXT, "dup2");
|
||||
*(void **)(&real_select) = dlsym(RTLD_NEXT, "select");
|
||||
*(void **)(&real_setitimer) = dlsym(RTLD_NEXT, "setitimer");
|
||||
*(void **)(&real_setsid) = dlsym(RTLD_NEXT, "setsid");
|
||||
*(void **)(&real_setsockopt) = dlsym(RTLD_NEXT, "setsockopt");
|
||||
*(void **)(&real_socket) = dlsym(RTLD_NEXT, "socket");
|
||||
*(void **)(&real_unlink) = dlsym(RTLD_NEXT, "unlink");
|
||||
@ -413,6 +419,7 @@ void _native_init_syscalls(void)
|
||||
*(void **)(&real_feof) = dlsym(RTLD_NEXT, "feof");
|
||||
*(void **)(&real_ferror) = dlsym(RTLD_NEXT, "ferror");
|
||||
*(void **)(&real_clearerr) = dlsym(RTLD_NEXT, "clearerr");
|
||||
*(void **)(&real_umask) = dlsym(RTLD_NEXT, "umask");
|
||||
#ifdef __MACH__
|
||||
#else
|
||||
*(void **)(&real_clock_gettime) = dlsym(RTLD_NEXT, "clock_gettime");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user