summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread/thr_fcntl.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libpthread/thread/thr_fcntl.c')
-rw-r--r--lib/libpthread/thread/thr_fcntl.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/libpthread/thread/thr_fcntl.c b/lib/libpthread/thread/thr_fcntl.c
index f5dd064..84f4678 100644
--- a/lib/libpthread/thread/thr_fcntl.c
+++ b/lib/libpthread/thread/thr_fcntl.c
@@ -34,10 +34,11 @@
#include <stdarg.h>
#include <unistd.h>
#include <fcntl.h>
-#ifdef _THREAD_SAFE
#include <pthread.h>
#include "pthread_private.h"
+#pragma weak fcntl=__fcntl
+
int
_fcntl(int fd, int cmd,...)
{
@@ -63,12 +64,12 @@ _fcntl(int fd, int cmd,...)
oldfd = va_arg(ap, int);
/* Initialise the file descriptor table entry: */
- if ((ret = _thread_sys_fcntl(fd, cmd, oldfd)) < 0) {
+ if ((ret = __sys_fcntl(fd, cmd, oldfd)) < 0) {
}
/* Initialise the file descriptor table entry: */
else if (_thread_fd_table_init(ret) != 0) {
/* Quietly close the file: */
- _thread_sys_close(ret);
+ __sys_close(ret);
/* Reset the file descriptor: */
ret = -1;
@@ -82,10 +83,10 @@ _fcntl(int fd, int cmd,...)
break;
case F_SETFD:
flags = va_arg(ap, int);
- ret = _thread_sys_fcntl(fd, cmd, flags);
+ ret = __sys_fcntl(fd, cmd, flags);
break;
case F_GETFD:
- ret = _thread_sys_fcntl(fd, cmd, 0);
+ ret = __sys_fcntl(fd, cmd, 0);
break;
case F_GETFL:
ret = _thread_fd_table[fd]->flags;
@@ -104,10 +105,10 @@ _fcntl(int fd, int cmd,...)
nonblock = flags & O_NONBLOCK;
/* Set the file descriptor flags: */
- if ((ret = _thread_sys_fcntl(fd, cmd, flags | O_NONBLOCK)) != 0) {
+ if ((ret = __sys_fcntl(fd, cmd, flags | O_NONBLOCK)) != 0) {
/* Get the flags so that we behave like the kernel: */
- } else if ((flags = _thread_sys_fcntl(fd,
+ } else if ((flags = __sys_fcntl(fd,
F_GETFL, 0)) == -1) {
/* Error getting flags: */
ret = -1;
@@ -125,7 +126,7 @@ _fcntl(int fd, int cmd,...)
break;
default:
/* Might want to make va_arg use a union */
- ret = _thread_sys_fcntl(fd, cmd, va_arg(ap, void *));
+ ret = __sys_fcntl(fd, cmd, va_arg(ap, void *));
break;
}
@@ -140,7 +141,7 @@ _fcntl(int fd, int cmd,...)
}
int
-fcntl(int fd, int cmd,...)
+__fcntl(int fd, int cmd,...)
{
int ret;
va_list ap;
@@ -167,4 +168,3 @@ fcntl(int fd, int cmd,...)
return ret;
}
-#endif
OpenPOWER on IntegriCloud