--- IO-AIO/AIO.xs 2010/01/07 18:25:51 1.160 +++ IO-AIO/AIO.xs 2010/01/10 20:28:43 1.161 @@ -18,6 +18,10 @@ #include #include +#if _POSIX_MEMLOCK +# include +#endif + /* perl namespace pollution */ #undef VERSION @@ -122,23 +126,18 @@ # define POSIX_FADV_NORMAL 0 # define NO_FADVISE 1 #endif - #ifndef POSIX_FADV_SEQUENTIAL # define POSIX_FADV_SEQUENTIAL 0 #endif - #ifndef POSIX_FADV_RANDOM # define POSIX_FADV_RANDOM 0 #endif - #ifndef POSIX_FADV_NOREUSE # define POSIX_FADV_NOREUSE 0 #endif - #ifndef POSIX_FADV_WILLNEED # define POSIX_FADV_WILLNEED 0 #endif - #ifndef POSIX_FADV_DONTNEED # define POSIX_FADV_DONTNEED 0 #endif @@ -146,43 +145,41 @@ #ifndef ST_NODEV # define ST_NODEV 0 #endif - #ifndef ST_NOEXEC # define ST_NOEXEC 0 #endif - #ifndef ST_SYNCHRONOUS # define ST_SYNCHRONOUS 0 #endif - #ifndef ST_MANDLOCK # define ST_MANDLOCK 0 #endif - #ifndef ST_WRITE # define ST_WRITE 0 #endif - #ifndef ST_APPEND # define ST_APPEND 0 #endif - #ifndef ST_IMMUTABLE # define ST_IMMUTABLE 0 #endif - #ifndef ST_NOATIME # define ST_NOATIME 0 #endif - #ifndef ST_NODIRATIME # define ST_NODIRATIME 0 #endif - #ifndef ST_RELATIME # define ST_RELATIME 0 #endif +#ifndef MCL_CURRENT +# define MCL_CURRENT 0 +#endif +#ifndef MCL_FUTURE +# define MCL_FUTURE 0 +#endif + static int req_invoke (eio_req *req); #define EIO_FINISH(req) req_invoke (req) static void req_destroy (eio_req *grp); @@ -631,6 +628,9 @@ const_iv (ST_NODIRATIME , ST_NODIRATIME) const_iv (ST_RELATIME , ST_RELATIME) + const_iv (MCL_FUTURE , MCL_FUTURE) + const_iv (MCL_CURRENT , MCL_CURRENT) + const_eio (MS_ASYNC) const_eio (MS_INVALIDATE) const_eio (MS_SYNC) @@ -1275,6 +1275,36 @@ OUTPUT: RETVAL +int +mlockall (int flags) + PROTOTYPE: $ + CODE: +#if _POSIX_MEMLOCK +#if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 7 + extern int mallopt (int, int); + mallopt (-6, 238); /* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=473812 */ +#endif + mlockall (flags); +#else + RETVAL =-1; + errno = ENOSYS; +#endif + OUTPUT: + RETVAL + +int +munlockall () + PROTOTYPE: + CODE: +#if _POSIX_MEMLOCK + munlockall (); +#else + RETVAL =-1; + errno = ENOSYS; +#endif + OUTPUT: + RETVAL + void _on_next_submit (SV *cb) CODE: SvREFCNT_dec (on_next_submit);