… | |
… | |
3 | #include <errno.h> |
3 | #include <errno.h> |
4 | |
4 | |
5 | #include "EXTERN.h" |
5 | #include "EXTERN.h" |
6 | #include "perl.h" |
6 | #include "perl.h" |
7 | #include "XSUB.h" |
7 | #include "XSUB.h" |
|
|
8 | #include "perliol.h" |
8 | |
9 | |
9 | #if !defined mg_findext |
10 | #if !defined mg_findext |
10 | # define mg_findext(sv,type,vtbl) mg_find (sv, type) |
11 | # define mg_findext(sv,type,vtbl) mg_find (sv, type) |
11 | #endif |
12 | #endif |
12 | |
13 | |
… | |
… | |
116 | |
117 | |
117 | #if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES |
118 | #if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES |
118 | # include <sys/mman.h> |
119 | # include <sys/mman.h> |
119 | #endif |
120 | #endif |
120 | |
121 | |
|
|
122 | #if HAVE_SYS_UIO_H |
|
|
123 | # include <sys/uio.h> |
|
|
124 | #endif |
|
|
125 | |
121 | #if HAVE_ST_XTIMENSEC |
126 | #if HAVE_ST_XTIMENSEC |
122 | # define ATIMENSEC PL_statcache.st_atimensec |
127 | # define ATIMENSEC PL_statcache.st_atimensec |
123 | # define MTIMENSEC PL_statcache.st_mtimensec |
128 | # define MTIMENSEC PL_statcache.st_mtimensec |
124 | # define CTIMENSEC PL_statcache.st_ctimensec |
129 | # define CTIMENSEC PL_statcache.st_ctimensec |
125 | #elif HAVE_ST_XTIMESPEC |
130 | #elif HAVE_ST_XTIMESPEC |
… | |
… | |
815 | #endif |
820 | #endif |
816 | } |
821 | } |
817 | else |
822 | else |
818 | PUSHs (sv_result); |
823 | PUSHs (sv_result); |
819 | break; |
824 | break; |
|
|
825 | |
|
|
826 | #if 0 |
|
|
827 | case EIO_CLOSE: |
|
|
828 | PerlIOUnix_refcnt_dec (req->int1); |
|
|
829 | break; |
|
|
830 | #endif |
820 | |
831 | |
821 | case EIO_DUP2: /* EIO_DUP2 actually means aio_close(), so fudge result value */ |
832 | case EIO_DUP2: /* EIO_DUP2 actually means aio_close(), so fudge result value */ |
822 | if (req->result > 0) |
833 | if (req->result > 0) |
823 | SvIV_set (sv_result, 0); |
834 | SvIV_set (sv_result, 0); |
824 | /* FALLTHROUGH */ |
835 | /* FALLTHROUGH */ |
… | |
… | |
1473 | aio_close (SV *fh, SV *callback = &PL_sv_undef) |
1484 | aio_close (SV *fh, SV *callback = &PL_sv_undef) |
1474 | PPCODE: |
1485 | PPCODE: |
1475 | { |
1486 | { |
1476 | int fd = s_fileno_croak (fh, 0); |
1487 | int fd = s_fileno_croak (fh, 0); |
1477 | dREQ; |
1488 | dREQ; |
|
|
1489 | #if 0 |
|
|
1490 | /* partially duplicate logic in s_fileno */ |
|
|
1491 | SvGETMAGIC (fh); |
1478 | |
1492 | |
|
|
1493 | if (SvROK (fh)) |
|
|
1494 | { |
|
|
1495 | fh = SvRV (fh); |
|
|
1496 | SvGETMAGIC (fh); |
|
|
1497 | } |
|
|
1498 | |
|
|
1499 | if (SvTYPE (fh) == SVt_PVGV) |
|
|
1500 | { |
|
|
1501 | /* perl filehandle */ |
|
|
1502 | PerlIOUnix_refcnt_inc (fd); |
|
|
1503 | do_close ((GV *)fh, 1); |
|
|
1504 | |
|
|
1505 | req->type = EIO_CLOSE; |
|
|
1506 | req->int1 = fd; |
|
|
1507 | /*req->sv2 = newSVsv (fh);*/ /* since we stole the fd, no need to keep the fh */ |
|
|
1508 | } |
|
|
1509 | else |
|
|
1510 | #endif |
|
|
1511 | { |
|
|
1512 | /* fd number */ |
1479 | req->type = EIO_DUP2; |
1513 | req->type = EIO_DUP2; |
1480 | req->int1 = close_fd; |
1514 | req->int1 = close_fd; |
1481 | req->sv2 = newSVsv (fh); |
1515 | req->sv2 = newSVsv (fh); |
1482 | req->int2 = fd; |
1516 | req->int2 = fd; |
|
|
1517 | } |
1483 | |
1518 | |
1484 | REQ_SEND; |
1519 | REQ_SEND; |
1485 | } |
1520 | } |
1486 | |
1521 | |
1487 | void |
1522 | void |
… | |
… | |
2246 | OUTPUT: |
2281 | OUTPUT: |
2247 | RETVAL |
2282 | RETVAL |
2248 | |
2283 | |
2249 | int |
2284 | int |
2250 | mlockall (int flags) |
2285 | mlockall (int flags) |
|
|
2286 | PROTOTYPE: $; |
2251 | CODE: |
2287 | CODE: |
2252 | RETVAL = eio_mlockall_sync (flags); |
2288 | RETVAL = eio_mlockall_sync (flags); |
2253 | OUTPUT: |
2289 | OUTPUT: |
2254 | RETVAL |
2290 | RETVAL |
2255 | |
2291 | |