1999-11-28 05:38:13 +00:00
|
|
|
/*
|
|
|
|
* David Leonard <d@openbsd.org>, 1999. Public Domain.
|
|
|
|
*
|
|
|
|
* $OpenBSD: uthread_msync.c,v 1.2 1999/06/09 07:16:17 d Exp $
|
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <pthread.h>
|
2002-09-16 08:45:36 +00:00
|
|
|
#include "thr_private.h"
|
1999-11-28 05:38:13 +00:00
|
|
|
|
2001-04-10 04:19:21 +00:00
|
|
|
__weak_reference(__msync, msync);
|
2001-01-24 13:03:38 +00:00
|
|
|
|
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
|
|
|
int
|
2001-01-24 13:03:38 +00:00
|
|
|
__msync(void *addr, size_t len, int flags)
|
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
|
|
|
{
|
2003-04-18 05:04:16 +00:00
|
|
|
struct pthread *curthread = _get_curthread();
|
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
|
|
|
int ret;
|
|
|
|
|
1999-11-28 05:38:13 +00:00
|
|
|
/*
|
|
|
|
* XXX This is quite pointless unless we know how to get the
|
|
|
|
* file descriptor associated with the memory, and lock it for
|
|
|
|
* write. The only real use of this wrapper is to guarantee
|
|
|
|
* a cancellation point, as per the standard. sigh.
|
|
|
|
*/
|
2003-12-09 02:20:56 +00:00
|
|
|
_thr_cancel_enter(curthread);
|
2002-09-16 19:52:52 +00:00
|
|
|
ret = __sys_msync(addr, len, flags);
|
2003-12-09 02:20:56 +00:00
|
|
|
_thr_cancel_leave(curthread, 1);
|
1999-11-28 05:38:13 +00:00
|
|
|
|
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
|
|
|
return ret;
|
1999-11-28 05:38:13 +00:00
|
|
|
}
|