1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #1322 from Kijewski/native-pipe-and-close

native: use `real_pipe()` and `read_close()`
This commit is contained in:
Christian Mehlis 2014-06-18 11:22:12 +02:00
commit 80ecdaca17
5 changed files with 9 additions and 4 deletions

View File

@ -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

View File

@ -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()");
}

View File

@ -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);

View File

@ -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];

View File

@ -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)
{