… | |
… | |
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 |
… | |
… | |
1273 | const_eio (SEEK_CUR) |
1274 | const_eio (SEEK_CUR) |
1274 | const_eio (SEEK_END) |
1275 | const_eio (SEEK_END) |
1275 | |
1276 | |
1276 | const_eio (MCL_FUTURE) |
1277 | const_eio (MCL_FUTURE) |
1277 | const_eio (MCL_CURRENT) |
1278 | const_eio (MCL_CURRENT) |
|
|
1279 | const_eio (MCL_ONFAULT) |
1278 | |
1280 | |
1279 | const_eio (MS_ASYNC) |
1281 | const_eio (MS_ASYNC) |
1280 | const_eio (MS_INVALIDATE) |
1282 | const_eio (MS_INVALIDATE) |
1281 | const_eio (MS_SYNC) |
1283 | const_eio (MS_SYNC) |
1282 | |
1284 | |
… | |
… | |
1470 | |
1472 | |
1471 | void |
1473 | void |
1472 | aio_close (SV *fh, SV *callback = &PL_sv_undef) |
1474 | aio_close (SV *fh, SV *callback = &PL_sv_undef) |
1473 | PPCODE: |
1475 | PPCODE: |
1474 | { |
1476 | { |
|
|
1477 | dREQ; |
1475 | int fd = s_fileno_croak (fh, 0); |
1478 | int fd = s_fileno_croak (fh, 0); |
1476 | dREQ; |
|
|
1477 | |
1479 | |
|
|
1480 | /* partially duplicate logic in s_fileno */ |
|
|
1481 | SvGETMAGIC (fh); |
|
|
1482 | |
|
|
1483 | if (SvROK (fh)) |
|
|
1484 | { |
|
|
1485 | fh = SvRV (fh); |
|
|
1486 | SvGETMAGIC (fh); |
|
|
1487 | } |
|
|
1488 | |
|
|
1489 | if (SvTYPE (fh) == SVt_PVGV) |
|
|
1490 | { |
|
|
1491 | /* perl filehandle */ |
|
|
1492 | PerlIOUnix_refcnt_inc (fd); |
|
|
1493 | do_close ((GV *)fh, 1); |
|
|
1494 | |
1478 | req->type = EIO_DUP2; |
1495 | req->type = EIO_CLOSE; |
1479 | req->int1 = close_fd; |
1496 | req->int1 = fd; |
1480 | req->sv2 = newSVsv (fh); |
1497 | req->sv2 = newSVsv (fh); |
|
|
1498 | } |
|
|
1499 | else |
|
|
1500 | { |
|
|
1501 | /* fd number */ |
|
|
1502 | req->type = EIO_DUP2; |
|
|
1503 | req->int1 = close_fd; |
|
|
1504 | req->sv2 = newSVsv (fh); |
1481 | req->int2 = fd; |
1505 | req->int2 = fd; |
|
|
1506 | } |
1482 | |
1507 | |
1483 | REQ_SEND; |
1508 | REQ_SEND; |
1484 | } |
1509 | } |
1485 | |
1510 | |
1486 | void |
1511 | void |
… | |
… | |
2244 | } |
2269 | } |
2245 | OUTPUT: |
2270 | OUTPUT: |
2246 | RETVAL |
2271 | RETVAL |
2247 | |
2272 | |
2248 | int |
2273 | int |
|
|
2274 | mlockall (int flags) |
|
|
2275 | PROTOTYPE: $; |
|
|
2276 | CODE: |
|
|
2277 | RETVAL = eio_mlockall_sync (flags); |
|
|
2278 | OUTPUT: |
|
|
2279 | RETVAL |
|
|
2280 | |
|
|
2281 | int |
2249 | munlockall () |
2282 | munlockall () |
2250 | CODE: |
2283 | CODE: |
2251 | #if _POSIX_MEMLOCK |
2284 | #if _POSIX_MEMLOCK |
2252 | munlockall (); |
2285 | munlockall (); |
2253 | #else |
2286 | #else |