summaryrefslogtreecommitdiff
path: root/lib/libc_r
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>1999-01-08 05:42:19 +0000
committerDavid Leonard <d@cvs.openbsd.org>1999-01-08 05:42:19 +0000
commit5673126f3eec127dc685472f2303514a6ef88341 (patch)
tree2f7ea906b40334eb5a2713f56b2778d1503074fe /lib/libc_r
parentc19ab492e22314efb26c343eb222ded42e50da0f (diff)
add fchflags and fpathconf as well.
Diffstat (limited to 'lib/libc_r')
-rw-r--r--lib/libc_r/uthread/Makefile.inc6
-rw-r--r--lib/libc_r/uthread/pthread_private.h5
-rw-r--r--lib/libc_r/uthread/uthread_fchflags.c24
-rw-r--r--lib/libc_r/uthread/uthread_fpathconf.c23
4 files changed, 54 insertions, 4 deletions
diff --git a/lib/libc_r/uthread/Makefile.inc b/lib/libc_r/uthread/Makefile.inc
index 4b4ad139bf8..bbaea92c049 100644
--- a/lib/libc_r/uthread/Makefile.inc
+++ b/lib/libc_r/uthread/Makefile.inc
@@ -1,5 +1,5 @@
-# $Id: Makefile.inc,v 1.4 1999/01/08 04:59:49 d Exp $
-# $OpenBSD: Makefile.inc,v 1.4 1999/01/08 04:59:49 d Exp $
+# $Id: Makefile.inc,v 1.5 1999/01/08 05:42:18 d Exp $
+# $OpenBSD: Makefile.inc,v 1.5 1999/01/08 05:42:18 d Exp $
# uthread sources
.PATH: ${.CURDIR}/uthread
@@ -32,6 +32,7 @@ SRCS+= \
uthread_equal.c \
uthread_execve.c \
uthread_exit.c \
+ uthread_fchflags.c \
uthread_fchmod.c \
uthread_fchown.c \
uthread_fcntl.c \
@@ -40,6 +41,7 @@ SRCS+= \
uthread_find_thread.c \
uthread_flock.c \
uthread_fork.c \
+ uthread_fpathconf.c \
uthread_fstat.c \
uthread_fstatfs.c \
uthread_fsync.c \
diff --git a/lib/libc_r/uthread/pthread_private.h b/lib/libc_r/uthread/pthread_private.h
index 9772235728e..7b3f6a7bcd4 100644
--- a/lib/libc_r/uthread/pthread_private.h
+++ b/lib/libc_r/uthread/pthread_private.h
@@ -31,7 +31,7 @@
*
* Private thread definitions for the uthread kernel.
*
- * $OpenBSD: pthread_private.h,v 1.7 1999/01/08 04:59:50 d Exp $
+ * $OpenBSD: pthread_private.h,v 1.8 1999/01/08 05:42:18 d Exp $
*
*/
@@ -595,7 +595,7 @@ void (*_thread_sys_signal(int, void (*)(int)))(int);
#ifdef _SYS_STAT_H_
int _thread_sys_fchmod(int, mode_t);
int _thread_sys_fstat(int, struct stat *);
-int _thread_sys_fchflags(int, u_long);
+int _thread_sys_fchflags(int, unsigned int);
#endif
/* #include <sys/mount.h> */
@@ -699,6 +699,7 @@ int _thread_sys_fchdir(int);
int _thread_sys_fchown(int, uid_t, gid_t);
int _thread_sys_fsync(int);
int _thread_sys_ftruncate(int, off_t);
+long _thread_sys_fpathconf(int, int);
int _thread_sys_pause(void);
int _thread_sys_pipe(int *);
int _thread_sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
diff --git a/lib/libc_r/uthread/uthread_fchflags.c b/lib/libc_r/uthread/uthread_fchflags.c
new file mode 100644
index 00000000000..da333f4b14f
--- /dev/null
+++ b/lib/libc_r/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
diff --git a/lib/libc_r/uthread/uthread_fpathconf.c b/lib/libc_r/uthread/uthread_fpathconf.c
new file mode 100644
index 00000000000..4ccd80ee81a
--- /dev/null
+++ b/lib/libc_r/uthread/uthread_fpathconf.c
@@ -0,0 +1,23 @@
+/*
+ * David Leonard <d@openbsd.org>, 1999. Public Domain.
+ *
+ * $OpenBSD: uthread_fpathconf.c,v 1.1 1999/01/08 05:42:18 d Exp $
+ */
+
+#include <unistd.h>
+#ifdef _THREAD_SAFE
+#include <pthread.h>
+#include "pthread_private.h"
+
+long
+fpathconf(int fd, int name)
+{
+ int ret;
+
+ if ((ret = _FD_LOCK(fd, FD_READ, NULL)) == 0) {
+ ret = _thread_sys_fpathconf(fd, name);
+ _FD_UNLOCK(fd, FD_READ);
+ }
+ return (ret);
+}
+#endif