… | |
… | |
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 | |
… | |
… | |
17 | #include <sys/socket.h> |
18 | #include <sys/socket.h> |
18 | #include <sys/stat.h> |
19 | #include <sys/stat.h> |
19 | #include <limits.h> |
20 | #include <limits.h> |
20 | #include <fcntl.h> |
21 | #include <fcntl.h> |
21 | #include <sched.h> |
22 | #include <sched.h> |
22 | |
|
|
23 | #if HAVE_SYS_MKDEV_H |
|
|
24 | # include <sys/mkdev.h> |
|
|
25 | #elif HAVE_SYS_SYSMACROS_H |
|
|
26 | # include <sys/sysmacros.h> |
|
|
27 | #endif |
|
|
28 | |
|
|
29 | #if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES |
|
|
30 | # include <sys/mman.h> |
|
|
31 | #endif |
|
|
32 | |
23 | |
33 | /* the incompetent fool that created musl keeps __linux__, refuses |
24 | /* the incompetent fool that created musl keeps __linux__, refuses |
34 | * to implement any linux standard apis, and also has no way to test |
25 | * to implement any linux standard apis, and also has no way to test |
35 | * for his broken iplementation. don't complain to me if this fails |
26 | * for his broken iplementation. don't complain to me if this fails |
36 | * for you. |
27 | * for you. |
… | |
… | |
116 | |
107 | |
117 | /*****************************************************************************/ |
108 | /*****************************************************************************/ |
118 | |
109 | |
119 | #include "config.h" |
110 | #include "config.h" |
120 | |
111 | |
|
|
112 | #if HAVE_SYS_MKDEV_H |
|
|
113 | # include <sys/mkdev.h> |
|
|
114 | #elif HAVE_SYS_SYSMACROS_H |
|
|
115 | # include <sys/sysmacros.h> |
|
|
116 | #endif |
|
|
117 | |
|
|
118 | #if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES |
|
|
119 | # include <sys/mman.h> |
|
|
120 | #endif |
|
|
121 | |
121 | #if HAVE_ST_XTIMENSEC |
122 | #if HAVE_ST_XTIMENSEC |
122 | # define ATIMENSEC PL_statcache.st_atimensec |
123 | # define ATIMENSEC PL_statcache.st_atimensec |
123 | # define MTIMENSEC PL_statcache.st_mtimensec |
124 | # define MTIMENSEC PL_statcache.st_mtimensec |
124 | # define CTIMENSEC PL_statcache.st_ctimensec |
125 | # define CTIMENSEC PL_statcache.st_ctimensec |
125 | #elif HAVE_ST_XTIMESPEC |
126 | #elif HAVE_ST_XTIMESPEC |
… | |
… | |
815 | #endif |
816 | #endif |
816 | } |
817 | } |
817 | else |
818 | else |
818 | PUSHs (sv_result); |
819 | PUSHs (sv_result); |
819 | break; |
820 | break; |
|
|
821 | |
|
|
822 | #if 0 |
|
|
823 | case EIO_CLOSE: |
|
|
824 | PerlIOUnix_refcnt_dec (req->int1); |
|
|
825 | break; |
|
|
826 | #endif |
820 | |
827 | |
821 | case EIO_DUP2: /* EIO_DUP2 actually means aio_close(), so fudge result value */ |
828 | case EIO_DUP2: /* EIO_DUP2 actually means aio_close(), so fudge result value */ |
822 | if (req->result > 0) |
829 | if (req->result > 0) |
823 | SvIV_set (sv_result, 0); |
830 | SvIV_set (sv_result, 0); |
824 | /* FALLTHROUGH */ |
831 | /* FALLTHROUGH */ |
… | |
… | |
1273 | const_eio (SEEK_CUR) |
1280 | const_eio (SEEK_CUR) |
1274 | const_eio (SEEK_END) |
1281 | const_eio (SEEK_END) |
1275 | |
1282 | |
1276 | const_eio (MCL_FUTURE) |
1283 | const_eio (MCL_FUTURE) |
1277 | const_eio (MCL_CURRENT) |
1284 | const_eio (MCL_CURRENT) |
|
|
1285 | const_eio (MCL_ONFAULT) |
1278 | |
1286 | |
1279 | const_eio (MS_ASYNC) |
1287 | const_eio (MS_ASYNC) |
1280 | const_eio (MS_INVALIDATE) |
1288 | const_eio (MS_INVALIDATE) |
1281 | const_eio (MS_SYNC) |
1289 | const_eio (MS_SYNC) |
1282 | |
1290 | |
… | |
… | |
1472 | aio_close (SV *fh, SV *callback = &PL_sv_undef) |
1480 | aio_close (SV *fh, SV *callback = &PL_sv_undef) |
1473 | PPCODE: |
1481 | PPCODE: |
1474 | { |
1482 | { |
1475 | int fd = s_fileno_croak (fh, 0); |
1483 | int fd = s_fileno_croak (fh, 0); |
1476 | dREQ; |
1484 | dREQ; |
|
|
1485 | #if 0 |
|
|
1486 | /* partially duplicate logic in s_fileno */ |
|
|
1487 | SvGETMAGIC (fh); |
1477 | |
1488 | |
|
|
1489 | if (SvROK (fh)) |
|
|
1490 | { |
|
|
1491 | fh = SvRV (fh); |
|
|
1492 | SvGETMAGIC (fh); |
|
|
1493 | } |
|
|
1494 | |
|
|
1495 | if (SvTYPE (fh) == SVt_PVGV) |
|
|
1496 | { |
|
|
1497 | /* perl filehandle */ |
|
|
1498 | PerlIOUnix_refcnt_inc (fd); |
|
|
1499 | do_close ((GV *)fh, 1); |
|
|
1500 | |
|
|
1501 | req->type = EIO_CLOSE; |
|
|
1502 | req->int1 = fd; |
|
|
1503 | /*req->sv2 = newSVsv (fh);*/ /* since we stole the fd, no need to keep the fh */ |
|
|
1504 | } |
|
|
1505 | else |
|
|
1506 | #endif |
|
|
1507 | { |
|
|
1508 | /* fd number */ |
1478 | req->type = EIO_DUP2; |
1509 | req->type = EIO_DUP2; |
1479 | req->int1 = close_fd; |
1510 | req->int1 = close_fd; |
1480 | req->sv2 = newSVsv (fh); |
1511 | req->sv2 = newSVsv (fh); |
1481 | req->int2 = fd; |
1512 | req->int2 = fd; |
|
|
1513 | } |
1482 | |
1514 | |
1483 | REQ_SEND; |
1515 | REQ_SEND; |
1484 | } |
1516 | } |
1485 | |
1517 | |
1486 | void |
1518 | void |
… | |
… | |
2244 | } |
2276 | } |
2245 | OUTPUT: |
2277 | OUTPUT: |
2246 | RETVAL |
2278 | RETVAL |
2247 | |
2279 | |
2248 | int |
2280 | int |
|
|
2281 | mlockall (int flags) |
|
|
2282 | PROTOTYPE: $; |
|
|
2283 | CODE: |
|
|
2284 | RETVAL = eio_mlockall_sync (flags); |
|
|
2285 | OUTPUT: |
|
|
2286 | RETVAL |
|
|
2287 | |
|
|
2288 | int |
2249 | munlockall () |
2289 | munlockall () |
2250 | CODE: |
2290 | CODE: |
2251 | #if _POSIX_MEMLOCK |
2291 | #if _POSIX_MEMLOCK |
2252 | munlockall (); |
2292 | munlockall (); |
2253 | #else |
2293 | #else |