diff options
Diffstat (limited to 'libc/misc')
-rw-r--r-- | libc/misc/dirent/closedir.c | 6 | ||||
-rw-r--r-- | libc/misc/dirent/opendir.c | 14 | ||||
-rw-r--r-- | libc/misc/utmp/utent.c | 27 | ||||
-rw-r--r-- | libc/misc/utmp/wtent.c | 14 |
4 files changed, 0 insertions, 61 deletions
diff --git a/libc/misc/dirent/closedir.c b/libc/misc/dirent/closedir.c index a7d980fc7..dfb53f888 100644 --- a/libc/misc/dirent/closedir.c +++ b/libc/misc/dirent/closedir.c @@ -9,9 +9,7 @@ #include <stdlib.h> #include <unistd.h> #include "dirstream.h" -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ #include <not-cancel.h> -#endif int closedir(DIR * dir) @@ -34,10 +32,6 @@ int closedir(DIR * dir) __UCLIBC_MUTEX_UNLOCK(dir->dd_lock); free(dir->dd_buf); free(dir); -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ return close_not_cancel(fd); -#else - return close(fd); -#endif } libc_hidden_def(closedir) diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c index a2cfd5197..c2e008a3a 100644 --- a/libc/misc/dirent/opendir.c +++ b/libc/misc/dirent/opendir.c @@ -12,9 +12,7 @@ #include <unistd.h> #include <sys/dir.h> #include <sys/stat.h> -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ #include <not-cancel.h> -#endif #include <dirent.h> #include "dirstream.h" @@ -89,11 +87,7 @@ DIR *opendir(const char *name) # define O_CLOEXEC 0 #endif -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ fd = open_not_cancel_2(name, O_RDONLY|O_NDELAY|O_DIRECTORY|O_CLOEXEC); -#else - fd = open(name, O_RDONLY|O_NDELAY|O_DIRECTORY|O_CLOEXEC); -#endif if (fd < 0) return NULL; /* Note: we should check to make sure that between the stat() and open() @@ -105,11 +99,7 @@ DIR *opendir(const char *name) /* this close() never fails *int saved_errno; *saved_errno = errno; */ -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ close_not_cancel_no_status(fd); -#else - close(fd); -#endif /*__set_errno(saved_errno);*/ return NULL; } @@ -123,11 +113,7 @@ DIR *opendir(const char *name) ptr = fd_to_DIR(fd, statbuf.st_blksize); if (!ptr) { -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ close_not_cancel_no_status(fd); -#else - close(fd); -#endif __set_errno(ENOMEM); } return ptr; diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c index 0176bbf6f..edada173e 100644 --- a/libc/misc/utmp/utent.c +++ b/libc/misc/utmp/utent.c @@ -19,10 +19,7 @@ #include <errno.h> #include <string.h> #include <utmp.h> - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ #include <not-cancel.h> -#endif #include <bits/uClibc_mutex.h> __UCLIBC_MUTEX_STATIC(utmplock, PTHREAD_MUTEX_INITIALIZER); @@ -42,17 +39,9 @@ static void __setutent(void) # define O_CLOEXEC 0 #endif -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ static_fd = open_not_cancel_2(static_ut_name, O_RDWR | O_CLOEXEC); -#else - static_fd = open(static_ut_name, O_RDWR | O_CLOEXEC); -#endif if (static_fd < 0) { -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ static_fd = open_not_cancel_2(static_ut_name, O_RDONLY | O_CLOEXEC); -#else - static_fd = open(static_ut_name, O_RDONLY | O_CLOEXEC); -#endif if (static_fd < 0) { return; /* static_fd remains < 0 */ } @@ -60,11 +49,7 @@ static void __setutent(void) if (O_CLOEXEC == 0) { /* Make sure the file will be closed on exec() */ -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ fcntl_not_cancel(static_fd, F_SETFD, FD_CLOEXEC); -#else - fcntl(static_fd, F_SETFD, FD_CLOEXEC); -#endif /* thus far, {G,S}ETFD only has this single flag, * and setting it never fails. *int ret = fcntl(static_fd, F_GETFD, 0); @@ -101,11 +86,7 @@ static struct utmp *__getutent(void) } } -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ if (read_not_cancel(static_fd, &static_utmp, sizeof(static_utmp)) == sizeof(static_utmp)) { -#else - if (read(static_fd, &static_utmp, sizeof(static_utmp)) == sizeof(static_utmp)) { -#endif ret = &static_utmp; } @@ -116,11 +97,7 @@ void endutent(void) { __UCLIBC_MUTEX_LOCK(utmplock); if (static_fd >= 0) -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ close_not_cancel_no_status(static_fd); -#else - close(static_fd); -#endif static_fd = -1; __UCLIBC_MUTEX_UNLOCK(utmplock); } @@ -221,11 +198,7 @@ int utmpname(const char *new_ut_name) } if (static_fd >= 0) { -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ close_not_cancel_no_status(static_fd); -#else - close(static_fd); -#endif static_fd = -1; } __UCLIBC_MUTEX_UNLOCK(utmplock); diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c index 9b2763701..5ab743d9b 100644 --- a/libc/misc/utmp/wtent.c +++ b/libc/misc/utmp/wtent.c @@ -13,10 +13,7 @@ #include <utmp.h> #include <fcntl.h> #include <sys/file.h> -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -#include <errno.h> #include <not-cancel.h> -#endif #if 0 /* This is enabled in uClibc/libutil/logwtmp.c */ @@ -40,7 +37,6 @@ void updwtmp(const char *wtmp_file, const struct utmp *lutmp) { int fd; -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ fd = open_not_cancel(wtmp_file, O_APPEND | O_WRONLY, 0); if (fd >= 0) { if (lockf(fd, F_LOCK, 0) == 0) { @@ -49,14 +45,4 @@ void updwtmp(const char *wtmp_file, const struct utmp *lutmp) close_not_cancel_no_status(fd); } } -#else - fd = open(wtmp_file, O_APPEND | O_WRONLY); - if (fd >= 0) { - if (lockf(fd, F_LOCK, 0) == 0) { - write(fd, lutmp, sizeof(*lutmp)); - lockf(fd, F_ULOCK, 0); - close(fd); - } - } -#endif } |