1999-11-28 05:38:13 +00:00
|
|
|
/*
|
|
|
|
* David Leonard <d@openbsd.org>, 1999. Public Domain.
|
|
|
|
*
|
|
|
|
* $OpenBSD: uthread_fchflags.c,v 1.1 1999/01/08 05:42:18 d Exp $
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
#include "pthread_private.h"
|
|
|
|
|
2001-01-24 13:03:38 +00:00
|
|
|
#pragma weak fchflags=_fchflags
|
1999-11-28 05:38:13 +00:00
|
|
|
int
|
Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),
just use _foo() <-- foo(). In the case of a libpthread that doesn't do
call conversion (such as linuxthreads and our upcoming libpthread), this
is adequate. In the case of libc_r, we still need three names, which are
now _thread_sys_foo() <-- _foo() <-- foo().
Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(),
nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo().
Remove all internal libc usage of: creat(), pause(), sleep(), system(),
tcdrain(), wait(), and waitpid().
Make thread cancellation fully POSIX-compliant.
Suggested by: deischen
2000-01-27 23:07:25 +00:00
|
|
|
_fchflags(int fd, u_long flags)
|
1999-11-28 05:38:13 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if ((ret = _FD_LOCK(fd, FD_WRITE, NULL)) == 0) {
|
2001-01-24 13:03:38 +00:00
|
|
|
ret = __sys_fchflags(fd, flags);
|
1999-11-28 05:38:13 +00:00
|
|
|
_FD_UNLOCK(fd, FD_WRITE);
|
|
|
|
}
|
|
|
|
return (ret);
|
|
|
|
}
|