… | |
… | |
21 | # include <sys/mman.h> |
21 | # include <sys/mman.h> |
22 | #endif |
22 | #endif |
23 | |
23 | |
24 | /* the incompetent fool that created musl keeps __linux__, refuses |
24 | /* the incompetent fool that created musl keeps __linux__, refuses |
25 | * 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 |
26 | * for his broken iplementation. on't complain if this fails for you. |
26 | * for his broken iplementation. don't complain to me if this fails |
|
|
27 | * for you. |
27 | */ |
28 | */ |
28 | #if __linux__ && (defined __GLIBC__ || defined __UCLIBC__) |
29 | #if __linux__ && (defined __GLIBC__ || defined __UCLIBC__) |
29 | # include <linux/fs.h> |
30 | # include <linux/fs.h> |
30 | # ifdef FS_IOC_FIEMAP |
31 | # ifdef FS_IOC_FIEMAP |
31 | # include <linux/types.h> |
32 | # include <linux/types.h> |
… | |
… | |
704 | { |
705 | { |
705 | while (eio_nreqs ()) |
706 | while (eio_nreqs ()) |
706 | { |
707 | { |
707 | int size; |
708 | int size; |
708 | |
709 | |
709 | X_LOCK (reslock); |
710 | X_LOCK (EIO_POOL->reslock); |
710 | size = res_queue.size; |
711 | size = EIO_POOL->res_queue.size; |
711 | X_UNLOCK (reslock); |
712 | X_UNLOCK (EIO_POOL->reslock); |
712 | |
713 | |
713 | if (size) |
714 | if (size) |
714 | return; |
715 | return; |
715 | |
716 | |
716 | etp_maybe_start_thread (); |
717 | etp_maybe_start_thread (EIO_POOL); |
717 | |
718 | |
718 | s_epipe_wait (&respipe); |
719 | s_epipe_wait (&respipe); |
719 | } |
720 | } |
720 | } |
721 | } |
721 | |
722 | |
… | |
… | |
985 | const_iv (MAP_SHARED) |
986 | const_iv (MAP_SHARED) |
986 | const_iv (MAP_FIXED) |
987 | const_iv (MAP_FIXED) |
987 | const_iv (MAP_ANONYMOUS) |
988 | const_iv (MAP_ANONYMOUS) |
988 | |
989 | |
989 | /* linuxish */ |
990 | /* linuxish */ |
990 | const_iv (MAP_HUGETLB) |
|
|
991 | const_iv (MAP_LOCKED) |
991 | const_iv (MAP_LOCKED) |
992 | const_iv (MAP_NORESERVE) |
992 | const_iv (MAP_NORESERVE) |
993 | const_iv (MAP_POPULATE) |
993 | const_iv (MAP_POPULATE) |
994 | const_iv (MAP_NONBLOCK) |
994 | const_iv (MAP_NONBLOCK) |
995 | const_iv (MAP_GROWSDOWN) |
995 | const_iv (MAP_GROWSDOWN) |
996 | const_iv (MAP_32BIT) |
996 | const_iv (MAP_32BIT) |
997 | const_iv (MAP_HUGETLB) |
997 | const_iv (MAP_HUGETLB) |
998 | const_iv (MAP_STACK) |
998 | const_iv (MAP_STACK) |
|
|
999 | |
|
|
1000 | const_iv (F_DUPFD_CLOEXEC) |
|
|
1001 | |
|
|
1002 | const_iv (F_OFD_GETLK) |
|
|
1003 | const_iv (F_OFD_SETLK) |
|
|
1004 | const_iv (F_OFD_GETLKW) |
|
|
1005 | |
|
|
1006 | const_iv (FIFREEZE) |
|
|
1007 | const_iv (FITHAW) |
|
|
1008 | const_iv (FITRIM) |
|
|
1009 | const_iv (FICLONE) |
|
|
1010 | const_iv (FICLONERANGE) |
|
|
1011 | const_iv (FIDEDUPERANGE) |
|
|
1012 | |
|
|
1013 | const_iv (FS_IOC_GETFLAGS) |
|
|
1014 | const_iv (FS_IOC_SETFLAGS) |
|
|
1015 | const_iv (FS_IOC_GETVERSION) |
|
|
1016 | const_iv (FS_IOC_SETVERSION) |
|
|
1017 | const_iv (FS_IOC_FIEMAP) |
|
|
1018 | const_iv (FS_IOC_FSGETXATTR) |
|
|
1019 | const_iv (FS_IOC_FSSETXATTR) |
|
|
1020 | const_iv (FS_IOC_SET_ENCRYPTION_POLICY) |
|
|
1021 | const_iv (FS_IOC_GET_ENCRYPTION_PWSALT) |
|
|
1022 | const_iv (FS_IOC_GET_ENCRYPTION_POLICY) |
|
|
1023 | |
|
|
1024 | const_iv (FS_KEY_DESCRIPTOR_SIZE) |
|
|
1025 | |
|
|
1026 | const_iv (FS_SECRM_FL) |
|
|
1027 | const_iv (FS_UNRM_FL) |
|
|
1028 | const_iv (FS_COMPR_FL) |
|
|
1029 | const_iv (FS_SYNC_FL) |
|
|
1030 | const_iv (FS_IMMUTABLE_FL) |
|
|
1031 | const_iv (FS_APPEND_FL) |
|
|
1032 | const_iv (FS_NODUMP_FL) |
|
|
1033 | const_iv (FS_NOATIME_FL) |
|
|
1034 | const_iv (FS_DIRTY_FL) |
|
|
1035 | const_iv (FS_COMPRBLK_FL) |
|
|
1036 | const_iv (FS_NOCOMP_FL) |
|
|
1037 | const_iv (FS_ENCRYPT_FL) |
|
|
1038 | const_iv (FS_BTREE_FL) |
|
|
1039 | const_iv (FS_INDEX_FL) |
|
|
1040 | const_iv (FS_JOURNAL_DATA_FL) |
|
|
1041 | const_iv (FS_NOTAIL_FL) |
|
|
1042 | const_iv (FS_DIRSYNC_FL) |
|
|
1043 | const_iv (FS_TOPDIR_FL) |
|
|
1044 | const_iv (FS_FL_USER_MODIFIABLE) |
|
|
1045 | |
|
|
1046 | const_iv (FS_XFLAG_REALTIME) |
|
|
1047 | const_iv (FS_XFLAG_PREALLOC) |
|
|
1048 | const_iv (FS_XFLAG_IMMUTABLE) |
|
|
1049 | const_iv (FS_XFLAG_APPEND) |
|
|
1050 | const_iv (FS_XFLAG_SYNC) |
|
|
1051 | const_iv (FS_XFLAG_NOATIME) |
|
|
1052 | const_iv (FS_XFLAG_NODUMP) |
|
|
1053 | const_iv (FS_XFLAG_RTINHERIT) |
|
|
1054 | const_iv (FS_XFLAG_PROJINHERIT) |
|
|
1055 | const_iv (FS_XFLAG_NOSYMLINKS) |
|
|
1056 | const_iv (FS_XFLAG_EXTSIZE) |
|
|
1057 | const_iv (FS_XFLAG_EXTSZINHERIT) |
|
|
1058 | const_iv (FS_XFLAG_NODEFRAG) |
|
|
1059 | const_iv (FS_XFLAG_FILESTREAM) |
|
|
1060 | const_iv (FS_XFLAG_DAX) |
|
|
1061 | const_iv (FS_XFLAG_HASATTR) |
999 | |
1062 | |
1000 | const_iv (FIEMAP_FLAG_SYNC) |
1063 | const_iv (FIEMAP_FLAG_SYNC) |
1001 | const_iv (FIEMAP_FLAG_XATTR) |
1064 | const_iv (FIEMAP_FLAG_XATTR) |
1002 | const_iv (FIEMAP_FLAGS_COMPAT) |
1065 | const_iv (FIEMAP_FLAGS_COMPAT) |
1003 | const_iv (FIEMAP_EXTENT_LAST) |
1066 | const_iv (FIEMAP_EXTENT_LAST) |
… | |
… | |
1037 | |
1100 | |
1038 | const_eio (FALLOC_FL_KEEP_SIZE) |
1101 | const_eio (FALLOC_FL_KEEP_SIZE) |
1039 | const_eio (FALLOC_FL_PUNCH_HOLE) |
1102 | const_eio (FALLOC_FL_PUNCH_HOLE) |
1040 | const_eio (FALLOC_FL_COLLAPSE_RANGE) |
1103 | const_eio (FALLOC_FL_COLLAPSE_RANGE) |
1041 | const_eio (FALLOC_FL_ZERO_RANGE) |
1104 | const_eio (FALLOC_FL_ZERO_RANGE) |
|
|
1105 | const_eio (FALLOC_FL_INSERT_RANGE) |
|
|
1106 | const_eio (FALLOC_FL_UNSHARE_RANGE) |
|
|
1107 | |
|
|
1108 | const_eio (RENAME_NOREPLACE) |
|
|
1109 | const_eio (RENAME_EXCHANGE) |
|
|
1110 | const_eio (RENAME_WHITEOUT) |
1042 | |
1111 | |
1043 | const_eio (READDIR_DENTS) |
1112 | const_eio (READDIR_DENTS) |
1044 | const_eio (READDIR_DIRS_FIRST) |
1113 | const_eio (READDIR_DIRS_FIRST) |
1045 | const_eio (READDIR_STAT_ORDER) |
1114 | const_eio (READDIR_STAT_ORDER) |
1046 | const_eio (READDIR_FOUND_UNKNOWN) |
1115 | const_eio (READDIR_FOUND_UNKNOWN) |
… | |
… | |
1297 | REQ_SEND; |
1366 | REQ_SEND; |
1298 | } |
1367 | } |
1299 | } |
1368 | } |
1300 | |
1369 | |
1301 | void |
1370 | void |
|
|
1371 | aio_ioctl (SV *fh, unsigned long request, SV8 *arg, SV *callback = &PL_sv_undef) |
|
|
1372 | ALIAS: |
|
|
1373 | aio_ioctl = EIO_IOCTL |
|
|
1374 | aio_fcntl = EIO_FCNTL |
|
|
1375 | PPCODE: |
|
|
1376 | { |
|
|
1377 | int fd = s_fileno_croak (fh, 0); |
|
|
1378 | char *svptr; |
|
|
1379 | |
|
|
1380 | if (SvPOK (arg) || !SvNIOK (arg)) |
|
|
1381 | { |
|
|
1382 | STRLEN svlen; |
|
|
1383 | /* perl uses IOCPARM_LEN for fcntl, so we do, too */ |
|
|
1384 | #ifdef IOCPARM_LEN |
|
|
1385 | STRLEN need = IOCPARM_LEN (request); |
|
|
1386 | #else |
|
|
1387 | STRLEN need = 256; |
|
|
1388 | #endif |
|
|
1389 | |
|
|
1390 | if (svlen < need) |
|
|
1391 | svptr = SvGROW (arg, need); |
|
|
1392 | } |
|
|
1393 | else |
|
|
1394 | svptr = (char *)SvIV (arg); |
|
|
1395 | |
|
|
1396 | { |
|
|
1397 | dREQ; |
|
|
1398 | |
|
|
1399 | req->type = ix; |
|
|
1400 | req->sv1 = newSVsv (fh); |
|
|
1401 | req->int1 = fd; |
|
|
1402 | req->int2 = (long)request; |
|
|
1403 | req->sv2 = SvREFCNT_inc (arg); |
|
|
1404 | req->ptr2 = svptr; |
|
|
1405 | |
|
|
1406 | REQ_SEND; |
|
|
1407 | } |
|
|
1408 | } |
|
|
1409 | |
|
|
1410 | void |
1302 | aio_readlink (SV8 *pathname, SV *callback = &PL_sv_undef) |
1411 | aio_readlink (SV8 *pathname, SV *callback = &PL_sv_undef) |
1303 | ALIAS: |
1412 | ALIAS: |
1304 | aio_readlink = EIO_READLINK |
1413 | aio_readlink = EIO_READLINK |
1305 | aio_realpath = EIO_REALPATH |
1414 | aio_realpath = EIO_REALPATH |
1306 | PPCODE: |
1415 | PPCODE: |
… | |
… | |
1366 | UV |
1475 | UV |
1367 | major (UV dev) |
1476 | major (UV dev) |
1368 | ALIAS: |
1477 | ALIAS: |
1369 | minor = 1 |
1478 | minor = 1 |
1370 | CODE: |
1479 | CODE: |
1371 | RETVAL = ix ? major (dev) : minor (dev); |
1480 | RETVAL = ix ? minor (dev) : major (dev); |
1372 | OUTPUT: |
1481 | OUTPUT: |
1373 | RETVAL |
1482 | RETVAL |
1374 | |
1483 | |
1375 | UV |
1484 | UV |
1376 | makedev (UV maj, UV min) |
1485 | makedev (UV maj, UV min) |
… | |
… | |
1493 | |
1602 | |
1494 | REQ_SEND; |
1603 | REQ_SEND; |
1495 | } |
1604 | } |
1496 | |
1605 | |
1497 | void |
1606 | void |
|
|
1607 | aio_rename2 (SV8 *oldpath, SV8 *newpath, int flags = 0, SV *callback = &PL_sv_undef) |
|
|
1608 | PPCODE: |
|
|
1609 | { |
|
|
1610 | eio_wd wd2 = 0; |
|
|
1611 | dREQ; |
|
|
1612 | |
|
|
1613 | req->type = EIO_RENAME; |
|
|
1614 | req_set_path1 (req, oldpath); |
|
|
1615 | req_set_path (req, newpath, &req->sv2, &req->sv4, &wd2, &req->ptr2); |
|
|
1616 | req->int2 = flags; |
|
|
1617 | req->int3 = (long)wd2; |
|
|
1618 | |
|
|
1619 | REQ_SEND; |
|
|
1620 | } |
|
|
1621 | |
|
|
1622 | void |
1498 | aio_mknod (SV8 *pathname, int mode, UV dev, SV *callback = &PL_sv_undef) |
1623 | aio_mknod (SV8 *pathname, int mode, UV dev, SV *callback = &PL_sv_undef) |
1499 | PPCODE: |
1624 | PPCODE: |
1500 | { |
1625 | { |
1501 | dREQ; |
1626 | dREQ; |
1502 | |
1627 | |
… | |
… | |
1507 | |
1632 | |
1508 | REQ_SEND; |
1633 | REQ_SEND; |
1509 | } |
1634 | } |
1510 | |
1635 | |
1511 | void |
1636 | void |
1512 | aio_mtouch (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, int flags = 0, SV *callback = &PL_sv_undef) |
1637 | aio_mtouch (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, int flags = -1, SV *callback = &PL_sv_undef) |
1513 | ALIAS: |
1638 | ALIAS: |
1514 | aio_mtouch = EIO_MTOUCH |
1639 | aio_mtouch = EIO_MTOUCH |
1515 | aio_msync = EIO_MSYNC |
1640 | aio_msync = EIO_MSYNC |
1516 | PPCODE: |
1641 | PPCODE: |
1517 | { |
1642 | { |
1518 | STRLEN svlen; |
1643 | STRLEN svlen; |
1519 | char *svptr = SvPVbyte (data, svlen); |
1644 | char *svptr = SvPVbyte (data, svlen); |
1520 | UV len = SvUV (length); |
1645 | UV len = SvUV (length); |
|
|
1646 | |
|
|
1647 | if (flags < 0) |
|
|
1648 | flags = ix == EIO_MSYNC ? EIO_MS_SYNC : 0; |
1521 | |
1649 | |
1522 | if (offset < 0) |
1650 | if (offset < 0) |
1523 | offset += svlen; |
1651 | offset += svlen; |
1524 | |
1652 | |
1525 | if (offset < 0 || offset > svlen) |
1653 | if (offset < 0 || offset > svlen) |