thr_msync.c revision 174112
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: head/lib/libkse/thread/thr_msync.c 174112 2007-11-30 17:20:29Z deischen $ 7 */ 8 9#include "namespace.h" 10#include <sys/types.h> 11#include <sys/mman.h> 12#include <pthread.h> 13#include "un-namespace.h" 14#include "thr_private.h" 15 16LT10_COMPAT_PRIVATE(__msync); 17LT10_COMPAT_DEFAULT(msync); 18 19int __msync(void *addr, size_t len, int flags); 20 21__weak_reference(__msync, msync); 22 23int 24__msync(void *addr, size_t len, int flags) 25{ 26 struct pthread *curthread = _get_curthread(); 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 _thr_cancel_enter(curthread); 36 ret = __sys_msync(addr, len, flags); 37 _thr_cancel_leave(curthread, 1); 38 39 return (ret); 40} 41