Initial import from FreeBSD RELENG_4:
[games.git] / lib / libc_r / uthread / uthread_msync.c
1 /*
2  * David Leonard <d@openbsd.org>, 1999. Public Domain.
3  *
4  * $OpenBSD: uthread_msync.c,v 1.2 1999/06/09 07:16:17 d Exp $
5  *
6  * $FreeBSD: src/lib/libc_r/uthread/uthread_msync.c,v 1.3.2.2 2002/10/22 14:44:03 fjoe Exp $
7  */
8
9 #include <sys/types.h>
10 #include <sys/mman.h>
11 #include <pthread.h>
12 #include "pthread_private.h"
13
14 int
15 _msync(void *addr, size_t len, int flags)
16 {
17         int ret;
18
19         ret = __sys_msync(addr, len, flags);
20
21         return (ret);
22 }
23
24 int
25 msync(void *addr, size_t len, int flags)
26 {
27         int     ret;
28
29         /*
30          * XXX This is quite pointless unless we know how to get the
31          * file descriptor associated with the memory, and lock it for
32          * write. The only real use of this wrapper is to guarantee
33          * a cancellation point, as per the standard. sigh.
34          */
35         _thread_enter_cancellation_point();
36         ret = _msync(addr, len, flags);
37         _thread_leave_cancellation_point();
38
39         return ret;
40 }