… | |
… | |
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> |
… | |
… | |
923 | const_niv (MADV_NORMAL , POSIX_MADV_NORMAL) |
924 | const_niv (MADV_NORMAL , POSIX_MADV_NORMAL) |
924 | const_niv (MADV_SEQUENTIAL, POSIX_MADV_SEQUENTIAL) |
925 | const_niv (MADV_SEQUENTIAL, POSIX_MADV_SEQUENTIAL) |
925 | const_niv (MADV_RANDOM , POSIX_MADV_RANDOM) |
926 | const_niv (MADV_RANDOM , POSIX_MADV_RANDOM) |
926 | const_niv (MADV_WILLNEED , POSIX_MADV_WILLNEED) |
927 | const_niv (MADV_WILLNEED , POSIX_MADV_WILLNEED) |
927 | const_niv (MADV_DONTNEED , POSIX_MADV_DONTNEED) |
928 | const_niv (MADV_DONTNEED , POSIX_MADV_DONTNEED) |
|
|
929 | const_niv (MADV_FREE , POSIX_MADV_FREE) |
928 | |
930 | |
929 | /* the second block will be 0 when missing */ |
931 | /* the second block will be 0 when missing */ |
930 | const_iv (O_RDONLY) |
932 | const_iv (O_RDONLY) |
931 | const_iv (O_WRONLY) |
933 | const_iv (O_WRONLY) |
932 | const_iv (O_RDWR) |
934 | const_iv (O_RDWR) |
… | |
… | |
993 | const_iv (MAP_NONBLOCK) |
995 | const_iv (MAP_NONBLOCK) |
994 | const_iv (MAP_GROWSDOWN) |
996 | const_iv (MAP_GROWSDOWN) |
995 | const_iv (MAP_32BIT) |
997 | const_iv (MAP_32BIT) |
996 | const_iv (MAP_HUGETLB) |
998 | const_iv (MAP_HUGETLB) |
997 | const_iv (MAP_STACK) |
999 | const_iv (MAP_STACK) |
|
|
1000 | |
|
|
1001 | const_iv (FIFREEZE) |
|
|
1002 | const_iv (FITHAW) |
|
|
1003 | const_iv (FITRIM) |
|
|
1004 | const_iv (FICLONE) |
|
|
1005 | const_iv (FICLONERANGE) |
|
|
1006 | const_iv (FIDEDUPERANGE) |
|
|
1007 | |
|
|
1008 | const_iv (FS_IOC_GETFLAGS) |
|
|
1009 | const_iv (FS_IOC_SETFLAGS) |
|
|
1010 | const_iv (FS_IOC_GETVERSION) |
|
|
1011 | const_iv (FS_IOC_SETVERSION) |
|
|
1012 | const_iv (FS_IOC_FIEMAP) |
|
|
1013 | const_iv (FS_IOC_FSGETXATTR) |
|
|
1014 | const_iv (FS_IOC_FSSETXATTR) |
|
|
1015 | const_iv (FS_IOC_SET_ENCRYPTION_POLICY) |
|
|
1016 | const_iv (FS_IOC_GET_ENCRYPTION_PWSALT) |
|
|
1017 | const_iv (FS_IOC_GET_ENCRYPTION_POLICY) |
|
|
1018 | |
|
|
1019 | const_iv (FS_KEY_DESCRIPTOR_SIZE) |
|
|
1020 | |
|
|
1021 | const_iv (FS_SECRM_FL) |
|
|
1022 | const_iv (FS_UNRM_FL) |
|
|
1023 | const_iv (FS_COMPR_FL) |
|
|
1024 | const_iv (FS_SYNC_FL) |
|
|
1025 | const_iv (FS_IMMUTABLE_FL) |
|
|
1026 | const_iv (FS_APPEND_FL) |
|
|
1027 | const_iv (FS_NODUMP_FL) |
|
|
1028 | const_iv (FS_NOATIME_FL) |
|
|
1029 | const_iv (FS_DIRTY_FL) |
|
|
1030 | const_iv (FS_COMPRBLK_FL) |
|
|
1031 | const_iv (FS_NOCOMP_FL) |
|
|
1032 | const_iv (FS_ENCRYPT_FL) |
|
|
1033 | const_iv (FS_BTREE_FL) |
|
|
1034 | const_iv (FS_INDEX_FL) |
|
|
1035 | const_iv (FS_JOURNAL_DATA_FL) |
|
|
1036 | const_iv (FS_NOTAIL_FL) |
|
|
1037 | const_iv (FS_DIRSYNC_FL) |
|
|
1038 | const_iv (FS_TOPDIR_FL) |
|
|
1039 | const_iv (FS_FL_USER_MODIFIABLE) |
|
|
1040 | |
|
|
1041 | const_iv (FS_XFLAG_REALTIME) |
|
|
1042 | const_iv (FS_XFLAG_PREALLOC) |
|
|
1043 | const_iv (FS_XFLAG_IMMUTABLE) |
|
|
1044 | const_iv (FS_XFLAG_APPEND) |
|
|
1045 | const_iv (FS_XFLAG_SYNC) |
|
|
1046 | const_iv (FS_XFLAG_NOATIME) |
|
|
1047 | const_iv (FS_XFLAG_NODUMP) |
|
|
1048 | const_iv (FS_XFLAG_RTINHERIT) |
|
|
1049 | const_iv (FS_XFLAG_PROJINHERIT) |
|
|
1050 | const_iv (FS_XFLAG_NOSYMLINKS) |
|
|
1051 | const_iv (FS_XFLAG_EXTSIZE) |
|
|
1052 | const_iv (FS_XFLAG_EXTSZINHERIT) |
|
|
1053 | const_iv (FS_XFLAG_NODEFRAG) |
|
|
1054 | const_iv (FS_XFLAG_FILESTREAM) |
|
|
1055 | const_iv (FS_XFLAG_DAX) |
|
|
1056 | const_iv (FS_XFLAG_HASATTR) |
998 | |
1057 | |
999 | const_iv (FIEMAP_FLAG_SYNC) |
1058 | const_iv (FIEMAP_FLAG_SYNC) |
1000 | const_iv (FIEMAP_FLAG_XATTR) |
1059 | const_iv (FIEMAP_FLAG_XATTR) |
1001 | const_iv (FIEMAP_FLAGS_COMPAT) |
1060 | const_iv (FIEMAP_FLAGS_COMPAT) |
1002 | const_iv (FIEMAP_EXTENT_LAST) |
1061 | const_iv (FIEMAP_EXTENT_LAST) |
… | |
… | |
1037 | const_eio (FALLOC_FL_KEEP_SIZE) |
1096 | const_eio (FALLOC_FL_KEEP_SIZE) |
1038 | const_eio (FALLOC_FL_PUNCH_HOLE) |
1097 | const_eio (FALLOC_FL_PUNCH_HOLE) |
1039 | const_eio (FALLOC_FL_COLLAPSE_RANGE) |
1098 | const_eio (FALLOC_FL_COLLAPSE_RANGE) |
1040 | const_eio (FALLOC_FL_ZERO_RANGE) |
1099 | const_eio (FALLOC_FL_ZERO_RANGE) |
1041 | |
1100 | |
|
|
1101 | const_eio (RENAME_NOREPLACE) |
|
|
1102 | const_eio (RENAME_EXCHANGE) |
|
|
1103 | const_eio (RENAME_WHITEOUT) |
|
|
1104 | |
1042 | const_eio (READDIR_DENTS) |
1105 | const_eio (READDIR_DENTS) |
1043 | const_eio (READDIR_DIRS_FIRST) |
1106 | const_eio (READDIR_DIRS_FIRST) |
1044 | const_eio (READDIR_STAT_ORDER) |
1107 | const_eio (READDIR_STAT_ORDER) |
1045 | const_eio (READDIR_FOUND_UNKNOWN) |
1108 | const_eio (READDIR_FOUND_UNKNOWN) |
1046 | |
1109 | |
… | |
… | |
1532 | |
1595 | |
1533 | REQ_SEND; |
1596 | REQ_SEND; |
1534 | } |
1597 | } |
1535 | |
1598 | |
1536 | void |
1599 | void |
|
|
1600 | aio_rename2 (SV8 *oldpath, SV8 *newpath, int flags = 0, SV *callback = &PL_sv_undef) |
|
|
1601 | PPCODE: |
|
|
1602 | { |
|
|
1603 | eio_wd wd2 = 0; |
|
|
1604 | dREQ; |
|
|
1605 | |
|
|
1606 | req->type = EIO_RENAME; |
|
|
1607 | req_set_path1 (req, oldpath); |
|
|
1608 | req_set_path (req, newpath, &req->sv2, &req->sv4, &wd2, &req->ptr2); |
|
|
1609 | req->int2 = flags; |
|
|
1610 | req->int3 = (long)wd2; |
|
|
1611 | |
|
|
1612 | REQ_SEND; |
|
|
1613 | } |
|
|
1614 | |
|
|
1615 | void |
1537 | aio_mknod (SV8 *pathname, int mode, UV dev, SV *callback = &PL_sv_undef) |
1616 | aio_mknod (SV8 *pathname, int mode, UV dev, SV *callback = &PL_sv_undef) |
1538 | PPCODE: |
1617 | PPCODE: |
1539 | { |
1618 | { |
1540 | dREQ; |
1619 | dREQ; |
1541 | |
1620 | |
… | |
… | |
1546 | |
1625 | |
1547 | REQ_SEND; |
1626 | REQ_SEND; |
1548 | } |
1627 | } |
1549 | |
1628 | |
1550 | void |
1629 | void |
1551 | aio_mtouch (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, int flags = 0, SV *callback = &PL_sv_undef) |
1630 | aio_mtouch (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, int flags = -1, SV *callback = &PL_sv_undef) |
1552 | ALIAS: |
1631 | ALIAS: |
1553 | aio_mtouch = EIO_MTOUCH |
1632 | aio_mtouch = EIO_MTOUCH |
1554 | aio_msync = EIO_MSYNC |
1633 | aio_msync = EIO_MSYNC |
1555 | PPCODE: |
1634 | PPCODE: |
1556 | { |
1635 | { |
1557 | STRLEN svlen; |
1636 | STRLEN svlen; |
1558 | char *svptr = SvPVbyte (data, svlen); |
1637 | char *svptr = SvPVbyte (data, svlen); |
1559 | UV len = SvUV (length); |
1638 | UV len = SvUV (length); |
|
|
1639 | |
|
|
1640 | if (flags < 0) |
|
|
1641 | flags = ix == EIO_MSYNC ? EIO_MS_SYNC : 0; |
1560 | |
1642 | |
1561 | if (offset < 0) |
1643 | if (offset < 0) |
1562 | offset += svlen; |
1644 | offset += svlen; |
1563 | |
1645 | |
1564 | if (offset < 0 || offset > svlen) |
1646 | if (offset < 0 || offset > svlen) |