… | |
… | |
145 | # define MAP_ANONYMOUS MAP_FIXED /* and hope this fails */ |
145 | # define MAP_ANONYMOUS MAP_FIXED /* and hope this fails */ |
146 | # endif |
146 | # endif |
147 | #endif |
147 | #endif |
148 | |
148 | |
149 | /* defines all sorts of constants to 0 unless they are already defined */ |
149 | /* defines all sorts of constants to 0 unless they are already defined */ |
|
|
150 | /* also provides const_iv_ and const_niv_ macros for them */ |
150 | #include "def0.h" |
151 | #include "def0.h" |
151 | |
152 | |
152 | #ifndef makedev |
153 | #ifndef makedev |
153 | # define makedev(maj,min) (((maj) << 8) | (min)) |
154 | # define makedev(maj,min) (((maj) << 8) | (min)) |
154 | #endif |
155 | #endif |
… | |
… | |
703 | { |
704 | { |
704 | while (eio_nreqs ()) |
705 | while (eio_nreqs ()) |
705 | { |
706 | { |
706 | int size; |
707 | int size; |
707 | |
708 | |
708 | X_LOCK (reslock); |
709 | X_LOCK (EIO_POOL->reslock); |
709 | size = res_queue.size; |
710 | size = EIO_POOL->res_queue.size; |
710 | X_UNLOCK (reslock); |
711 | X_UNLOCK (EIO_POOL->reslock); |
711 | |
712 | |
712 | if (size) |
713 | if (size) |
713 | return; |
714 | return; |
714 | |
715 | |
715 | etp_maybe_start_thread (); |
716 | etp_maybe_start_thread (EIO_POOL); |
716 | |
717 | |
717 | s_epipe_wait (&respipe); |
718 | s_epipe_wait (&respipe); |
718 | } |
719 | } |
719 | } |
720 | } |
720 | |
721 | |
… | |
… | |
751 | # define munmap(addr,length) EIO_ENOSYS () |
752 | # define munmap(addr,length) EIO_ENOSYS () |
752 | #endif |
753 | #endif |
753 | |
754 | |
754 | #if !_POSIX_MEMORY_PROTECTION |
755 | #if !_POSIX_MEMORY_PROTECTION |
755 | # define mprotect(addr,len,prot) EIO_ENOSYS () |
756 | # define mprotect(addr,len,prot) EIO_ENOSYS () |
756 | # define PROT_NONE 0 |
|
|
757 | # define PROT_WRITE 0 |
|
|
758 | # define MAP_PRIVATE 0 |
|
|
759 | # define MAP_SHARED 0 |
|
|
760 | # define MAP_FIXED 0 |
|
|
761 | #endif |
757 | #endif |
762 | |
758 | |
763 | #define MMAP_MAGIC PERL_MAGIC_ext |
759 | #define MMAP_MAGIC PERL_MAGIC_ext |
764 | |
760 | |
765 | static int ecb_cold |
761 | static int ecb_cold |
… | |
… | |
905 | } *civ, const_iv[] = { |
901 | } *civ, const_iv[] = { |
906 | # define const_niv(name, value) { # name, (IV) value }, |
902 | # define const_niv(name, value) { # name, (IV) value }, |
907 | # define const_iv(name) { # name, (IV) name }, |
903 | # define const_iv(name) { # name, (IV) name }, |
908 | # define const_eio(name) { # name, (IV) EIO_ ## name }, |
904 | # define const_eio(name) { # name, (IV) EIO_ ## name }, |
909 | |
905 | |
910 | /* you have to re-run ./gendef0 after adding/Removing any constants here */ |
906 | /* you have to re-run ./gendef0 after adding/removing any constants here */ |
911 | |
907 | /* the first block can be undef if missing */ |
912 | const_iv (ENOSYS) |
908 | const_iv (ENOSYS) |
913 | const_iv (EXDEV) |
909 | const_iv (EXDEV) |
914 | const_iv (EBADR) |
910 | const_iv (EBADR) |
915 | |
911 | |
|
|
912 | /* for lseek */ |
|
|
913 | const_iv (SEEK_DATA) |
|
|
914 | const_iv (SEEK_HOLE) |
|
|
915 | |
|
|
916 | const_niv (FADV_NORMAL , POSIX_FADV_NORMAL) |
|
|
917 | const_niv (FADV_SEQUENTIAL, POSIX_FADV_SEQUENTIAL) |
|
|
918 | const_niv (FADV_RANDOM , POSIX_FADV_RANDOM) |
|
|
919 | const_niv (FADV_NOREUSE , POSIX_FADV_NOREUSE) |
|
|
920 | const_niv (FADV_WILLNEED , POSIX_FADV_WILLNEED) |
|
|
921 | const_niv (FADV_DONTNEED , POSIX_FADV_DONTNEED) |
|
|
922 | |
|
|
923 | const_niv (MADV_NORMAL , POSIX_MADV_NORMAL) |
|
|
924 | const_niv (MADV_SEQUENTIAL, POSIX_MADV_SEQUENTIAL) |
|
|
925 | const_niv (MADV_RANDOM , POSIX_MADV_RANDOM) |
|
|
926 | const_niv (MADV_WILLNEED , POSIX_MADV_WILLNEED) |
|
|
927 | const_niv (MADV_DONTNEED , POSIX_MADV_DONTNEED) |
|
|
928 | const_niv (MADV_FREE , POSIX_MADV_FREE) |
|
|
929 | |
|
|
930 | /* the second block will be 0 when missing */ |
916 | const_iv (O_RDONLY) |
931 | const_iv (O_RDONLY) |
917 | const_iv (O_WRONLY) |
932 | const_iv (O_WRONLY) |
918 | const_iv (O_RDWR) |
933 | const_iv (O_RDWR) |
919 | const_iv (O_CREAT) |
934 | const_iv (O_CREAT) |
920 | const_iv (O_TRUNC) |
935 | const_iv (O_TRUNC) |
… | |
… | |
947 | const_iv (S_IFDIR) |
962 | const_iv (S_IFDIR) |
948 | const_iv (S_IFWHT) |
963 | const_iv (S_IFWHT) |
949 | const_iv (S_IFSOCK) |
964 | const_iv (S_IFSOCK) |
950 | const_iv (S_IFMT) |
965 | const_iv (S_IFMT) |
951 | |
966 | |
952 | const_niv (FADV_NORMAL , POSIX_FADV_NORMAL) |
|
|
953 | const_niv (FADV_SEQUENTIAL, POSIX_FADV_SEQUENTIAL) |
|
|
954 | const_niv (FADV_RANDOM , POSIX_FADV_RANDOM) |
|
|
955 | const_niv (FADV_NOREUSE , POSIX_FADV_NOREUSE) |
|
|
956 | const_niv (FADV_WILLNEED , POSIX_FADV_WILLNEED) |
|
|
957 | const_niv (FADV_DONTNEED , POSIX_FADV_DONTNEED) |
|
|
958 | |
|
|
959 | const_niv (MADV_NORMAL , POSIX_MADV_NORMAL) |
|
|
960 | const_niv (MADV_SEQUENTIAL, POSIX_MADV_SEQUENTIAL) |
|
|
961 | const_niv (MADV_RANDOM , POSIX_MADV_RANDOM) |
|
|
962 | const_niv (MADV_WILLNEED , POSIX_MADV_WILLNEED) |
|
|
963 | const_niv (MADV_DONTNEED , POSIX_MADV_DONTNEED) |
|
|
964 | |
|
|
965 | const_iv (ST_RDONLY) |
967 | const_iv (ST_RDONLY) |
966 | const_iv (ST_NOSUID) |
968 | const_iv (ST_NOSUID) |
967 | const_iv (ST_NODEV) |
969 | const_iv (ST_NODEV) |
968 | const_iv (ST_NOEXEC) |
970 | const_iv (ST_NOEXEC) |
969 | const_iv (ST_SYNCHRONOUS) |
971 | const_iv (ST_SYNCHRONOUS) |
… | |
… | |
978 | const_iv (PROT_NONE) |
980 | const_iv (PROT_NONE) |
979 | const_iv (PROT_EXEC) |
981 | const_iv (PROT_EXEC) |
980 | const_iv (PROT_READ) |
982 | const_iv (PROT_READ) |
981 | const_iv (PROT_WRITE) |
983 | const_iv (PROT_WRITE) |
982 | |
984 | |
983 | /*const_iv (MAP_FIXED)*/ |
|
|
984 | const_iv (MAP_PRIVATE) |
985 | const_iv (MAP_PRIVATE) |
985 | const_iv (MAP_SHARED) |
986 | const_iv (MAP_SHARED) |
|
|
987 | const_iv (MAP_FIXED) |
986 | const_iv (MAP_ANONYMOUS) |
988 | const_iv (MAP_ANONYMOUS) |
987 | |
989 | |
988 | /* linuxish */ |
990 | /* linuxish */ |
989 | const_iv (MAP_HUGETLB) |
|
|
990 | const_iv (MAP_LOCKED) |
991 | const_iv (MAP_LOCKED) |
991 | const_iv (MAP_NORESERVE) |
992 | const_iv (MAP_NORESERVE) |
992 | const_iv (MAP_POPULATE) |
993 | const_iv (MAP_POPULATE) |
993 | const_iv (MAP_NONBLOCK) |
994 | const_iv (MAP_NONBLOCK) |
|
|
995 | const_iv (MAP_GROWSDOWN) |
|
|
996 | const_iv (MAP_32BIT) |
|
|
997 | const_iv (MAP_HUGETLB) |
|
|
998 | const_iv (MAP_STACK) |
994 | |
999 | |
995 | const_iv (FIEMAP_FLAG_SYNC) |
1000 | const_iv (FIEMAP_FLAG_SYNC) |
996 | const_iv (FIEMAP_FLAG_XATTR) |
1001 | const_iv (FIEMAP_FLAG_XATTR) |
997 | const_iv (FIEMAP_FLAGS_COMPAT) |
1002 | const_iv (FIEMAP_FLAGS_COMPAT) |
998 | const_iv (FIEMAP_EXTENT_LAST) |
1003 | const_iv (FIEMAP_EXTENT_LAST) |
… | |
… | |
1010 | const_iv (SPLICE_F_MOVE) |
1015 | const_iv (SPLICE_F_MOVE) |
1011 | const_iv (SPLICE_F_NONBLOCK) |
1016 | const_iv (SPLICE_F_NONBLOCK) |
1012 | const_iv (SPLICE_F_MORE) |
1017 | const_iv (SPLICE_F_MORE) |
1013 | const_iv (SPLICE_F_GIFT) |
1018 | const_iv (SPLICE_F_GIFT) |
1014 | |
1019 | |
1015 | const_iv (SEEK_DATA) |
1020 | /* these are libeio constants, and are independent of gendef0 */ |
1016 | const_iv (SEEK_HOLE) |
|
|
1017 | |
|
|
1018 | /* libeio constants */ |
|
|
1019 | const_eio (SEEK_SET) |
1021 | const_eio (SEEK_SET) |
1020 | const_eio (SEEK_CUR) |
1022 | const_eio (SEEK_CUR) |
1021 | const_eio (SEEK_END) |
1023 | const_eio (SEEK_END) |
1022 | |
1024 | |
1023 | const_eio (MCL_FUTURE) |
1025 | const_eio (MCL_FUTURE) |
… | |
… | |
1295 | REQ_SEND; |
1297 | REQ_SEND; |
1296 | } |
1298 | } |
1297 | } |
1299 | } |
1298 | |
1300 | |
1299 | void |
1301 | void |
|
|
1302 | aio_ioctl (SV *fh, unsigned long request, SV8 *arg, SV *callback = &PL_sv_undef) |
|
|
1303 | ALIAS: |
|
|
1304 | aio_ioctl = EIO_IOCTL |
|
|
1305 | aio_fcntl = EIO_FCNTL |
|
|
1306 | PPCODE: |
|
|
1307 | { |
|
|
1308 | int fd = s_fileno_croak (fh, 0); |
|
|
1309 | char *svptr; |
|
|
1310 | |
|
|
1311 | if (SvPOK (arg) || !SvNIOK (arg)) |
|
|
1312 | { |
|
|
1313 | STRLEN svlen; |
|
|
1314 | /* perl uses IOCPARM_LEN for fcntl, so we do, too */ |
|
|
1315 | #ifdef IOCPARM_LEN |
|
|
1316 | STRLEN need = IOCPARM_LEN (request); |
|
|
1317 | #else |
|
|
1318 | STRLEN need = 256; |
|
|
1319 | #endif |
|
|
1320 | |
|
|
1321 | if (svlen < need) |
|
|
1322 | svptr = SvGROW (arg, need); |
|
|
1323 | } |
|
|
1324 | else |
|
|
1325 | svptr = (char *)SvIV (arg); |
|
|
1326 | |
|
|
1327 | { |
|
|
1328 | dREQ; |
|
|
1329 | |
|
|
1330 | req->type = ix; |
|
|
1331 | req->sv1 = newSVsv (fh); |
|
|
1332 | req->int1 = fd; |
|
|
1333 | req->int2 = (long)request; |
|
|
1334 | req->sv2 = SvREFCNT_inc (arg); |
|
|
1335 | req->ptr2 = svptr; |
|
|
1336 | |
|
|
1337 | REQ_SEND; |
|
|
1338 | } |
|
|
1339 | } |
|
|
1340 | |
|
|
1341 | void |
1300 | aio_readlink (SV8 *pathname, SV *callback = &PL_sv_undef) |
1342 | aio_readlink (SV8 *pathname, SV *callback = &PL_sv_undef) |
1301 | ALIAS: |
1343 | ALIAS: |
1302 | aio_readlink = EIO_READLINK |
1344 | aio_readlink = EIO_READLINK |
1303 | aio_realpath = EIO_REALPATH |
1345 | aio_realpath = EIO_REALPATH |
1304 | PPCODE: |
1346 | PPCODE: |
… | |
… | |
1364 | UV |
1406 | UV |
1365 | major (UV dev) |
1407 | major (UV dev) |
1366 | ALIAS: |
1408 | ALIAS: |
1367 | minor = 1 |
1409 | minor = 1 |
1368 | CODE: |
1410 | CODE: |
1369 | RETVAL = ix ? major (dev) : minor (dev); |
1411 | RETVAL = ix ? minor (dev) : major (dev); |
1370 | OUTPUT: |
1412 | OUTPUT: |
1371 | RETVAL |
1413 | RETVAL |
1372 | |
1414 | |
1373 | UV |
1415 | UV |
1374 | makedev (UV maj, UV min) |
1416 | makedev (UV maj, UV min) |