diff --git a/boards/native/drivers/native-uart0.c b/boards/native/drivers/native-uart0.c index 4f651d3b7f..cbed70d90d 100644 --- a/boards/native/drivers/native-uart0.c +++ b/boards/native/drivers/native-uart0.c @@ -217,7 +217,7 @@ void handle_uart_sock(void) t = sizeof(remote); _native_syscall_enter(); - if ((s = accept(_native_uart_sock, &remote, &t)) == -1) { + if ((s = real_accept(_native_uart_sock, &remote, &t)) == -1) { err(EXIT_FAILURE, "handle_uart_sock: accept"); } else { diff --git a/cpu/native/include/native_internal.h b/cpu/native/include/native_internal.h index 28c814c734..fa9880ff00 100644 --- a/cpu/native/include/native_internal.h +++ b/cpu/native/include/native_internal.h @@ -78,6 +78,8 @@ extern void* (*real_calloc)(size_t nmemb, size_t size); extern void* (*real_malloc)(size_t size); extern void* (*real_realloc)(void *ptr, size_t size); /* The ... is a hack to save includes: */ +extern int (*real_accept)(int socket, ...); +/* The ... is a hack to save includes: */ extern int (*real_bind)(int socket, ...); extern int (*real_close)(int); extern int (*real_dup2)(int, int); diff --git a/cpu/native/syscalls.c b/cpu/native/syscalls.c index 01bc226c17..38714e5577 100644 --- a/cpu/native/syscalls.c +++ b/cpu/native/syscalls.c @@ -55,6 +55,7 @@ void (*real_free)(void *ptr); void* (*real_malloc)(size_t size); void* (*real_calloc)(size_t nmemb, size_t size); void* (*real_realloc)(void *ptr, size_t size); +int (*real_accept)(int socket, ...); int (*real_bind)(int socket, ...); int (*real_printf)(const char *format, ...); int (*real_getpid)(void); @@ -355,6 +356,7 @@ void _native_init_syscalls(void) *(void **)(&real_malloc) = dlsym(RTLD_NEXT, "malloc"); *(void **)(&real_realloc) = dlsym(RTLD_NEXT, "realloc"); *(void **)(&real_free) = dlsym(RTLD_NEXT, "free"); + *(void **)(&real_accept) = dlsym(RTLD_NEXT, "accept"); *(void **)(&real_bind) = dlsym(RTLD_NEXT, "bind"); *(void **)(&real_printf) = dlsym(RTLD_NEXT, "printf"); *(void **)(&real_getpid) = dlsym(RTLD_NEXT, "getpid");