summaryrefslogtreecommitdiff
path: root/lib/libpthread/uthread/uthread_fchflags.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libpthread/uthread/uthread_fchflags.c')
-rw-r--r--lib/libpthread/uthread/uthread_fchflags.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/libpthread/uthread/uthread_fchflags.c b/lib/libpthread/uthread/uthread_fchflags.c
new file mode 100644
index 00000000000..da333f4b14f
--- /dev/null
+++ b/lib/libpthread/uthread/uthread_fchflags.c
@@ -0,0 +1,24 @@
+/*
+ * David Leonard <d@openbsd.org>, 1999. Public Domain.
+ *
+ * $OpenBSD: uthread_fchflags.c,v 1.1 1999/01/08 05:42:18 d Exp $
+ */
+
+#include <sys/stat.h>
+#include <unistd.h>
+#ifdef _THREAD_SAFE
+#include <pthread.h>
+#include "pthread_private.h"
+
+int
+fchflags(int fd, unsigned int flags)
+{
+ int ret;
+
+ if ((ret = _FD_LOCK(fd, FD_WRITE, NULL)) == 0) {
+ ret = _thread_sys_fchflags(fd, flags);
+ _FD_UNLOCK(fd, FD_WRITE);
+ }
+ return (ret);
+}
+#endif