… | |
… | |
16 | #include <sys/statvfs.h> |
16 | #include <sys/statvfs.h> |
17 | #include <limits.h> |
17 | #include <limits.h> |
18 | #include <fcntl.h> |
18 | #include <fcntl.h> |
19 | #include <sched.h> |
19 | #include <sched.h> |
20 | |
20 | |
21 | #if _POSIX_MEMLOCK || _POSIX_MAPPED_FILES |
21 | #if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES |
22 | # include <sys/mman.h> |
22 | # include <sys/mman.h> |
23 | #endif |
23 | #endif |
24 | |
24 | |
25 | /* perl namespace pollution */ |
25 | /* perl namespace pollution */ |
26 | #undef VERSION |
26 | #undef VERSION |
… | |
… | |
118 | STRLEN stroffset; \ |
118 | STRLEN stroffset; \ |
119 | SV *self; |
119 | SV *self; |
120 | |
120 | |
121 | #define EIO_NO_WRAPPERS 1 |
121 | #define EIO_NO_WRAPPERS 1 |
122 | |
122 | |
|
|
123 | #include "libeio/config.h" |
123 | #include "libeio/eio.h" |
124 | #include "libeio/eio.h" |
124 | |
125 | |
125 | #ifndef POSIX_FADV_NORMAL |
126 | #ifndef POSIX_FADV_NORMAL |
126 | # define POSIX_FADV_NORMAL 0 |
127 | # define POSIX_FADV_NORMAL 0 |
127 | #endif |
128 | #endif |
… | |
… | |
352 | /* do not recreate the result IV from scratch each time */ |
353 | /* do not recreate the result IV from scratch each time */ |
353 | if (expect_true (sv_result_cache)) |
354 | if (expect_true (sv_result_cache)) |
354 | { |
355 | { |
355 | sv_result = sv_result_cache; sv_result_cache = 0; |
356 | sv_result = sv_result_cache; sv_result_cache = 0; |
356 | SvIV_set (sv_result, req->result); |
357 | SvIV_set (sv_result, req->result); |
|
|
358 | SvIOK_only (sv_result); |
357 | } |
359 | } |
358 | else |
360 | else |
359 | { |
361 | { |
360 | sv_result = newSViv (req->result); |
362 | sv_result = newSViv (req->result); |
361 | SvREADONLY_on (sv_result); |
363 | SvREADONLY_on (sv_result); |
… | |
… | |
525 | SvSETMAGIC (req->sv2); |
527 | SvSETMAGIC (req->sv2); |
526 | PUSHs (sv_result); |
528 | PUSHs (sv_result); |
527 | } |
529 | } |
528 | break; |
530 | break; |
529 | |
531 | |
530 | case EIO_DUP2: /* EIO_DUP2 actually means aio_close(), su fudge result value */ |
532 | case EIO_DUP2: /* EIO_DUP2 actually means aio_close(), so fudge result value */ |
531 | if (req->result > 0) |
533 | if (req->result > 0) |
532 | SvIV_set (sv_result, 0); |
534 | SvIV_set (sv_result, 0); |
533 | /* FALLTHROUGH */ |
535 | /* FALLTHROUGH */ |
534 | |
536 | |
535 | default: |
537 | default: |
… | |
… | |
1522 | if (!SvOK (length) || len + offset > svlen) |
1524 | if (!SvOK (length) || len + offset > svlen) |
1523 | len = svlen - offset; |
1525 | len = svlen - offset; |
1524 | |
1526 | |
1525 | addr = (void *)(((intptr_t)addr) + offset); |
1527 | addr = (void *)(((intptr_t)addr) + offset); |
1526 | eio_page_align (&addr, &len); |
1528 | eio_page_align (&addr, &len); |
1527 | #if _POSIX_MEMLOCK |
1529 | #if _POSIX_MEMLOCK_RANGE |
1528 | RETVAL = munlock (addr, len); |
1530 | RETVAL = munlock (addr, len); |
1529 | #else |
1531 | #else |
1530 | RETVAL = ((errno = ENOSYS), -1); |
1532 | RETVAL = ((errno = ENOSYS), -1); |
1531 | #endif |
1533 | #endif |
1532 | } |
1534 | } |