mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #1751 from LudwigOrtmann/native_syscalls_p2
native: add two more syscall declarations
This commit is contained in:
commit
ec24fbd6dc
@ -122,7 +122,7 @@ int init_tcp_socket(char *tcpport)
|
|||||||
err(EXIT_FAILURE, "init_uart_socket: setsockopt");
|
err(EXIT_FAILURE, "init_uart_socket: setsockopt");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bind(s, p->ai_addr, p->ai_addrlen) == -1) {
|
if (real_bind(s, p->ai_addr, p->ai_addrlen) == -1) {
|
||||||
close(s);
|
close(s);
|
||||||
warn("init_uart_socket: bind");
|
warn("init_uart_socket: bind");
|
||||||
continue;
|
continue;
|
||||||
@ -135,7 +135,7 @@ int init_tcp_socket(char *tcpport)
|
|||||||
}
|
}
|
||||||
freeaddrinfo(info);
|
freeaddrinfo(info);
|
||||||
|
|
||||||
if (listen(s, 1) == -1) {
|
if (real_listen(s, 1) == -1) {
|
||||||
err(EXIT_FAILURE, "init_uart_socket: listen");
|
err(EXIT_FAILURE, "init_uart_socket: listen");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,11 +160,11 @@ int init_unix_socket(void)
|
|||||||
snprintf(sa.sun_path, sizeof(sa.sun_path), "/tmp/riot.tty.%d", _native_pid);
|
snprintf(sa.sun_path, sizeof(sa.sun_path), "/tmp/riot.tty.%d", _native_pid);
|
||||||
}
|
}
|
||||||
real_unlink(sa.sun_path); /* remove stale socket */
|
real_unlink(sa.sun_path); /* remove stale socket */
|
||||||
if (bind(s, (struct sockaddr *)&sa, SUN_LEN(&sa)) == -1) {
|
if (real_bind(s, (struct sockaddr *)&sa, SUN_LEN(&sa)) == -1) {
|
||||||
err(EXIT_FAILURE, "init_unix_socket: bind");
|
err(EXIT_FAILURE, "init_unix_socket: bind");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listen(s, 5) == -1) {
|
if (real_listen(s, 5) == -1) {
|
||||||
err(EXIT_FAILURE, "init_unix_socket: listen");
|
err(EXIT_FAILURE, "init_unix_socket: listen");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +71,8 @@ extern void (*real_free)(void *ptr);
|
|||||||
extern void* (*real_calloc)(size_t nmemb, size_t size);
|
extern void* (*real_calloc)(size_t nmemb, size_t size);
|
||||||
extern void* (*real_malloc)(size_t size);
|
extern void* (*real_malloc)(size_t size);
|
||||||
extern void* (*real_realloc)(void *ptr, size_t size);
|
extern void* (*real_realloc)(void *ptr, size_t size);
|
||||||
|
/* The ... is a hack to save includes: */
|
||||||
|
extern int (*real_bind)(int socket, ...);
|
||||||
extern int (*real_close)(int);
|
extern int (*real_close)(int);
|
||||||
extern int (*real_dup2)(int, int);
|
extern int (*real_dup2)(int, int);
|
||||||
extern int (*real_execve)(const char *, char *const[], char *const[]);
|
extern int (*real_execve)(const char *, char *const[], char *const[]);
|
||||||
@ -78,6 +80,7 @@ extern int (*real_feof)(FILE *stream);
|
|||||||
extern int (*real_ferror)(FILE *stream);
|
extern int (*real_ferror)(FILE *stream);
|
||||||
extern int (*real_fork)(void);
|
extern int (*real_fork)(void);
|
||||||
extern int (*real_getpid)(void);
|
extern int (*real_getpid)(void);
|
||||||
|
extern int (*real_listen)(int socket, int backlog);
|
||||||
extern int (*real_pause)(void);
|
extern int (*real_pause)(void);
|
||||||
extern int (*real_pipe)(int[2]);
|
extern int (*real_pipe)(int[2]);
|
||||||
extern int (*real_printf)(const char *format, ...);
|
extern int (*real_printf)(const char *format, ...);
|
||||||
|
@ -55,6 +55,7 @@ void (*real_free)(void *ptr);
|
|||||||
void* (*real_malloc)(size_t size);
|
void* (*real_malloc)(size_t size);
|
||||||
void* (*real_calloc)(size_t nmemb, size_t size);
|
void* (*real_calloc)(size_t nmemb, size_t size);
|
||||||
void* (*real_realloc)(void *ptr, size_t size);
|
void* (*real_realloc)(void *ptr, size_t size);
|
||||||
|
int (*real_bind)(int socket, ...);
|
||||||
int (*real_printf)(const char *format, ...);
|
int (*real_printf)(const char *format, ...);
|
||||||
int (*real_getpid)(void);
|
int (*real_getpid)(void);
|
||||||
int (*real_pipe)(int[2]);
|
int (*real_pipe)(int[2]);
|
||||||
@ -64,6 +65,7 @@ int (*real_execve)(const char *, char *const[], char *const[]);
|
|||||||
int (*real_fork)(void);
|
int (*real_fork)(void);
|
||||||
int (*real_feof)(FILE *stream);
|
int (*real_feof)(FILE *stream);
|
||||||
int (*real_ferror)(FILE *stream);
|
int (*real_ferror)(FILE *stream);
|
||||||
|
int (*real_listen)(int socket, int backlog);
|
||||||
int (*real_pause)(void);
|
int (*real_pause)(void);
|
||||||
int (*real_unlink)(const char *);
|
int (*real_unlink)(const char *);
|
||||||
FILE* (*real_fopen)(const char *path, const char *mode);
|
FILE* (*real_fopen)(const char *path, const char *mode);
|
||||||
@ -351,6 +353,7 @@ void _native_init_syscalls(void)
|
|||||||
*(void **)(&real_malloc) = dlsym(RTLD_NEXT, "malloc");
|
*(void **)(&real_malloc) = dlsym(RTLD_NEXT, "malloc");
|
||||||
*(void **)(&real_realloc) = dlsym(RTLD_NEXT, "realloc");
|
*(void **)(&real_realloc) = dlsym(RTLD_NEXT, "realloc");
|
||||||
*(void **)(&real_free) = dlsym(RTLD_NEXT, "free");
|
*(void **)(&real_free) = dlsym(RTLD_NEXT, "free");
|
||||||
|
*(void **)(&real_bind) = dlsym(RTLD_NEXT, "bind");
|
||||||
*(void **)(&real_printf) = dlsym(RTLD_NEXT, "printf");
|
*(void **)(&real_printf) = dlsym(RTLD_NEXT, "printf");
|
||||||
*(void **)(&real_getpid) = dlsym(RTLD_NEXT, "getpid");
|
*(void **)(&real_getpid) = dlsym(RTLD_NEXT, "getpid");
|
||||||
*(void **)(&real_pipe) = dlsym(RTLD_NEXT, "pipe");
|
*(void **)(&real_pipe) = dlsym(RTLD_NEXT, "pipe");
|
||||||
@ -359,6 +362,7 @@ void _native_init_syscalls(void)
|
|||||||
*(void **)(&real_dup2) = dlsym(RTLD_NEXT, "dup2");
|
*(void **)(&real_dup2) = dlsym(RTLD_NEXT, "dup2");
|
||||||
*(void **)(&real_unlink) = dlsym(RTLD_NEXT, "unlink");
|
*(void **)(&real_unlink) = dlsym(RTLD_NEXT, "unlink");
|
||||||
*(void **)(&real_execve) = dlsym(RTLD_NEXT, "execve");
|
*(void **)(&real_execve) = dlsym(RTLD_NEXT, "execve");
|
||||||
|
*(void **)(&real_listen) = dlsym(RTLD_NEXT, "listen");
|
||||||
*(void **)(&real_pause) = dlsym(RTLD_NEXT, "pause");
|
*(void **)(&real_pause) = dlsym(RTLD_NEXT, "pause");
|
||||||
*(void **)(&real_fopen) = dlsym(RTLD_NEXT, "fopen");
|
*(void **)(&real_fopen) = dlsym(RTLD_NEXT, "fopen");
|
||||||
*(void **)(&real_fread) = dlsym(RTLD_NEXT, "fread");
|
*(void **)(&real_fread) = dlsym(RTLD_NEXT, "fread");
|
||||||
|
Loading…
Reference in New Issue
Block a user