diff --git a/cpu/native/include/native_internal.h b/cpu/native/include/native_internal.h index 4e1055ec48..27befb3e7c 100644 --- a/cpu/native/include/native_internal.h +++ b/cpu/native/include/native_internal.h @@ -59,6 +59,8 @@ extern void (*real_free)(void *ptr); extern void* (*real_calloc)(size_t nmemb, size_t size); extern void* (*real_realloc)(void *ptr, size_t size); extern int (*real_getpid)(void); +extern int (*real_pipe)(int[2]); +extern int (*real_close)(int); /** * data structures diff --git a/cpu/native/irq_cpu.c b/cpu/native/irq_cpu.c index c5ba92f8f6..58e627aa70 100644 --- a/cpu/native/irq_cpu.c +++ b/cpu/native/irq_cpu.c @@ -503,7 +503,7 @@ void native_interrupt_init(void) _native_in_syscall = 0; - if (pipe(_sig_pipefd) == -1) { + if (real_pipe(_sig_pipefd) == -1) { err(EXIT_FAILURE, "native_interrupt_init(): pipe()"); } diff --git a/cpu/native/net/tap.c b/cpu/native/net/tap.c index 266f7c533d..22a514f677 100644 --- a/cpu/native/net/tap.c +++ b/cpu/native/net/tap.c @@ -287,7 +287,7 @@ int tap_init(char *name) if (ioctl(_native_tap_fd, SIOCGIFHWADDR, &ifr) == -1) { _native_in_syscall++; warn("ioctl SIOCGIFHWADDR"); - if (close(_native_tap_fd) == -1) { + if (real_close(_native_tap_fd) == -1) { warn("close"); } exit(EXIT_FAILURE); diff --git a/cpu/native/startup.c b/cpu/native/startup.c index 63851f10ae..51c88bb3f1 100644 --- a/cpu/native/startup.c +++ b/cpu/native/startup.c @@ -54,8 +54,7 @@ const char *_native_unix_socket_path = NULL; */ void _native_null_in(char *stdiotype) { - - if (pipe(_native_null_in_pipe) == -1) { + if (real_pipe(_native_null_in_pipe) == -1) { err(1, "_native_null_in(): pipe()"); } @@ -200,6 +199,8 @@ __attribute__((constructor)) static void startup(int argc, char **argv) *(void **)(&real_free) = dlsym(RTLD_NEXT, "free"); *(void **)(&real_printf) = dlsym(RTLD_NEXT, "printf"); *(void **)(&real_getpid) = dlsym(RTLD_NEXT, "getpid"); + *(void **)(&real_pipe) = dlsym(RTLD_NEXT, "pipe"); + *(void **)(&real_close) = dlsym(RTLD_NEXT, "close"); _native_argv = argv; _progname = argv[0]; diff --git a/cpu/native/syscalls.c b/cpu/native/syscalls.c index 41fe2d88c9..fffca56a95 100644 --- a/cpu/native/syscalls.c +++ b/cpu/native/syscalls.c @@ -54,6 +54,8 @@ void* (*real_malloc)(size_t size); void (*real_free)(void *ptr); void* (*real_calloc)(size_t nmemb, size_t size); void* (*real_realloc)(void *ptr, size_t size); +int (*real_pipe)(int[2]); +int (*real_close)(int); void _native_syscall_enter(void) {