From ddf9c4d55b914eefb8141eb34f77433307113c68 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 7 Jan 2011 21:45:42 +0000 Subject: *** empty log message *** --- Changes | 1 + eio.c | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Changes b/Changes index b85c71a..d882029 100644 --- a/Changes +++ b/Changes @@ -30,4 +30,5 @@ TODO: openbsd requites stdint.h for intptr_t - why posix? - "fix" demo.c so that it works as non-root. - suppoert utimes seperately from futimes, as some systems have utimes but not futimes. + - use _POSIX_MEMLOCK_RANGE for mlock. diff --git a/eio.c b/eio.c index 4963fc1..862b5ad 100644 --- a/eio.c +++ b/eio.c @@ -81,7 +81,7 @@ # include # include -#if _POSIX_MEMLOCK || _POSIX_MAPPED_FILES +#if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES # include #endif @@ -1433,18 +1433,9 @@ eio_page_align (void **addr, size_t *length) } #if !_POSIX_MEMLOCK -# define eio__mlock(a,b) ((errno = ENOSYS), -1) # define eio__mlockall(a) ((errno = ENOSYS), -1) #else -static int -eio__mlock (void *addr, size_t length) -{ - eio_page_align (&addr, &length); - - return mlock (addr, length); -} - static int eio__mlockall (int flags) { @@ -1465,6 +1456,20 @@ eio__mlockall (int flags) } #endif +#if !_POSIX_MEMLOCK_RANGE +# define eio__mlock(a,b) ((errno = ENOSYS), -1) +#else + +static int +eio__mlock (void *addr, size_t length) +{ + eio_page_align (&addr, &length); + + return mlock (addr, length); +} + +#endif + #if !(_POSIX_MAPPED_FILES && _POSIX_SYNCHRONIZED_IO) # define eio__msync(a,b,c) ((errno = ENOSYS), -1) #else -- cgit v1.2.3