… | |
… | |
84 | |
84 | |
85 | #else |
85 | #else |
86 | |
86 | |
87 | #include <sys/time.h> |
87 | #include <sys/time.h> |
88 | #include <sys/select.h> |
88 | #include <sys/select.h> |
|
|
89 | #include <sys/wait.h> |
89 | #include <unistd.h> |
90 | #include <unistd.h> |
90 | #include <utime.h> |
91 | #include <utime.h> |
91 | #include <signal.h> |
92 | #include <signal.h> |
92 | |
93 | |
93 | #define EIO_STRUCT_STAT Stat_t |
94 | #define EIO_STRUCT_STAT Stat_t |
… | |
… | |
226 | |
227 | |
227 | #if PAGESIZE <= 0 |
228 | #if PAGESIZE <= 0 |
228 | # define PAGESIZE sysconf (_SC_PAGESIZE) |
229 | # define PAGESIZE sysconf (_SC_PAGESIZE) |
229 | #endif |
230 | #endif |
230 | |
231 | |
|
|
232 | #if HAVE_SYSCALL |
|
|
233 | #include <sys/syscall.h> |
|
|
234 | #else |
|
|
235 | # define syscall(nr,...) (errno = ENOSYS, -1) |
|
|
236 | #endif |
|
|
237 | |
231 | /*****************************************************************************/ |
238 | /*****************************************************************************/ |
232 | |
239 | |
233 | #if !_POSIX_MAPPED_FILES |
240 | #if !_POSIX_MAPPED_FILES |
234 | # define mmap(addr,length,prot,flags,fd,offs) (errno = ENOSYS, (void *)-1) |
241 | # define mmap(addr,length,prot,flags,fd,offs) (errno = ENOSYS, (void *)-1) |
235 | # define munmap(addr,length) EIO_ENOSYS () |
242 | # define munmap(addr,length) EIO_ENOSYS () |
… | |
… | |
409 | { |
416 | { |
410 | struct fiemap_extent *e = incmap->fm_extents + count; |
417 | struct fiemap_extent *e = incmap->fm_extents + count; |
411 | |
418 | |
412 | fiemap->fm_extents [fiemap->fm_mapped_extents++] = *e; |
419 | fiemap->fm_extents [fiemap->fm_mapped_extents++] = *e; |
413 | |
420 | |
414 | if (e->fe_logical + e->fe_length >= end_offset) |
421 | if (e->fe_logical >= end_offset) |
415 | goto done; |
422 | goto done; |
416 | |
423 | |
417 | if (e->fe_flags & FIEMAP_EXTENT_LAST) |
424 | if (e->fe_flags & FIEMAP_EXTENT_LAST) |
418 | goto done; |
425 | goto done; |
419 | |
426 | |
… | |
… | |
1329 | const_iv (STATX_ATTR_APPEND) |
1336 | const_iv (STATX_ATTR_APPEND) |
1330 | const_iv (STATX_ATTR_NODUMP) |
1337 | const_iv (STATX_ATTR_NODUMP) |
1331 | const_iv (STATX_ATTR_ENCRYPTED) |
1338 | const_iv (STATX_ATTR_ENCRYPTED) |
1332 | const_iv (STATX_ATTR_AUTOMOUNT) |
1339 | const_iv (STATX_ATTR_AUTOMOUNT) |
1333 | |
1340 | |
|
|
1341 | const_iv (AT_FDCWD) |
|
|
1342 | const_iv (AT_SYMLINK_NOFOLLOW) |
|
|
1343 | const_iv (AT_EACCESS) |
|
|
1344 | const_iv (AT_REMOVEDIR) |
|
|
1345 | const_iv (AT_SYMLINK_FOLLOW) |
|
|
1346 | const_iv (AT_NO_AUTOMOUNT) |
|
|
1347 | const_iv (AT_EMPTY_PATH) |
|
|
1348 | const_iv (AT_STATX_SYNC_TYPE) |
|
|
1349 | const_iv (AT_STATX_AS_STAT) |
|
|
1350 | const_iv (AT_STATX_FORCE_SYNC) |
|
|
1351 | const_iv (AT_STATX_DONT_SYNC) |
|
|
1352 | const_iv (AT_RECURSIVE) |
|
|
1353 | |
|
|
1354 | const_iv (OPEN_TREE_CLONE) |
|
|
1355 | |
|
|
1356 | const_iv (FSOPEN_CLOEXEC) |
|
|
1357 | |
|
|
1358 | const_iv (FSPICK_CLOEXEC) |
|
|
1359 | const_iv (FSPICK_SYMLINK_NOFOLLOW) |
|
|
1360 | const_iv (FSPICK_NO_AUTOMOUNT) |
|
|
1361 | const_iv (FSPICK_EMPTY_PATH) |
|
|
1362 | |
|
|
1363 | const_iv (MOVE_MOUNT_F_SYMLINKS) |
|
|
1364 | const_iv (MOVE_MOUNT_F_AUTOMOUNTS) |
|
|
1365 | const_iv (MOVE_MOUNT_F_EMPTY_PATH) |
|
|
1366 | const_iv (MOVE_MOUNT_T_SYMLINKS) |
|
|
1367 | const_iv (MOVE_MOUNT_T_AUTOMOUNTS) |
|
|
1368 | const_iv (MOVE_MOUNT_T_EMPTY_PATH) |
|
|
1369 | |
|
|
1370 | /* waitid */ |
|
|
1371 | const_iv (P_PID) |
|
|
1372 | const_iv (P_PIDFD) |
|
|
1373 | const_iv (P_PGID) |
|
|
1374 | const_iv (P_ALL) |
|
|
1375 | |
|
|
1376 | const_iv (FSCONFIG_SET_FLAG) |
|
|
1377 | const_iv (FSCONFIG_SET_STRING) |
|
|
1378 | const_iv (FSCONFIG_SET_BINARY) |
|
|
1379 | const_iv (FSCONFIG_SET_PATH) |
|
|
1380 | const_iv (FSCONFIG_SET_PATH_EMPTY) |
|
|
1381 | const_iv (FSCONFIG_SET_FD) |
|
|
1382 | const_iv (FSCONFIG_CMD_CREATE) |
|
|
1383 | const_iv (FSCONFIG_CMD_RECONFIGURE) |
|
|
1384 | |
|
|
1385 | const_iv (MOUNT_ATTR_RDONLY) |
|
|
1386 | const_iv (MOUNT_ATTR_NOSUID) |
|
|
1387 | const_iv (MOUNT_ATTR_NODEV) |
|
|
1388 | const_iv (MOUNT_ATTR_NOEXEC) |
|
|
1389 | const_iv (MOUNT_ATTR__ATIME) |
|
|
1390 | const_iv (MOUNT_ATTR_RELATIME) |
|
|
1391 | const_iv (MOUNT_ATTR_NOATIME) |
|
|
1392 | const_iv (MOUNT_ATTR_STRICTATIME) |
|
|
1393 | const_iv (MOUNT_ATTR_NODIRATIME) |
|
|
1394 | |
1334 | /* these are libeio constants, and are independent of gendef0 */ |
1395 | /* these are libeio constants, and are independent of gendef0 */ |
1335 | const_eio (SEEK_SET) |
1396 | const_eio (SEEK_SET) |
1336 | const_eio (SEEK_CUR) |
1397 | const_eio (SEEK_CUR) |
1337 | const_eio (SEEK_END) |
1398 | const_eio (SEEK_END) |
1338 | |
1399 | |
… | |
… | |
2599 | PUSHs (newmortalFH (fd[1], O_WRONLY)); |
2660 | PUSHs (newmortalFH (fd[1], O_WRONLY)); |
2600 | } |
2661 | } |
2601 | } |
2662 | } |
2602 | |
2663 | |
2603 | void |
2664 | void |
|
|
2665 | pidfd_open (int pid, unsigned int flags = 0) |
|
|
2666 | PPCODE: |
|
|
2667 | { |
|
|
2668 | /*GENDEF0_SYSCALL(pidfd_open,434)*/ |
|
|
2669 | int fd = syscall (SYS_pidfd_open, pid, flags); |
|
|
2670 | XPUSHs (newmortalFH (fd, O_RDWR)); |
|
|
2671 | } |
|
|
2672 | |
|
|
2673 | int |
|
|
2674 | pidfd_send_signal (SV *pidfh, int sig, SV *siginfo = &PL_sv_undef, unsigned int flags = 0) |
|
|
2675 | PPCODE: |
|
|
2676 | { |
|
|
2677 | int res; |
|
|
2678 | siginfo_t si = { 0 }; |
|
|
2679 | |
|
|
2680 | if (SvOK (siginfo)) |
|
|
2681 | { |
|
|
2682 | HV *hv; |
|
|
2683 | SV **svp; |
|
|
2684 | |
|
|
2685 | if (!SvROK (siginfo) || SvTYPE (SvRV (siginfo)) != SVt_PVHV) |
|
|
2686 | croak ("siginfo argument must be a hashref code, pid, uid and value_int or value_ptr members, caught"); |
|
|
2687 | |
|
|
2688 | hv = (HV *)SvRV (siginfo); |
|
|
2689 | |
|
|
2690 | if ((svp = hv_fetchs (hv, "code" , 0))) si.si_code = SvIV (*svp); |
|
|
2691 | if ((svp = hv_fetchs (hv, "pid" , 0))) si.si_pid = SvIV (*svp); |
|
|
2692 | if ((svp = hv_fetchs (hv, "uid" , 0))) si.si_uid = SvIV (*svp); |
|
|
2693 | if ((svp = hv_fetchs (hv, "value_int", 0))) si.si_value.sival_int = SvIV (*svp); |
|
|
2694 | if ((svp = hv_fetchs (hv, "value_ptr", 0))) si.si_value.sival_ptr = (void *)SvIV (*svp); |
|
|
2695 | } |
|
|
2696 | |
|
|
2697 | /*GENDEF0_SYSCALL(pidfd_send_signal,424)*/ |
|
|
2698 | res = syscall (SYS_pidfd_send_signal, s_fileno_croak (pidfh, 0), sig, SvOK (siginfo) ? &si : 0, flags); |
|
|
2699 | |
|
|
2700 | XPUSHs (sv_2mortal (newSViv (res))); |
|
|
2701 | } |
|
|
2702 | |
|
|
2703 | void |
|
|
2704 | pidfd_getfd (SV *pidfh, int targetfd, unsigned int flags = 0) |
|
|
2705 | PPCODE: |
|
|
2706 | { |
|
|
2707 | /*GENDEF0_SYSCALL(pidfd_getfd,438)*/ |
|
|
2708 | int fd = syscall (SYS_pidfd_getfd, s_fileno_croak (pidfh, 0), targetfd, flags); |
|
|
2709 | XPUSHs (newmortalFH (fd, O_RDWR)); |
|
|
2710 | } |
|
|
2711 | |
|
|
2712 | void |
2604 | eventfd (unsigned int initval = 0, int flags = 0) |
2713 | eventfd (unsigned int initval = 0, int flags = 0) |
2605 | PPCODE: |
2714 | PPCODE: |
2606 | { |
2715 | { |
2607 | int fd; |
2716 | int fd; |
2608 | #if HAVE_EVENTFD |
2717 | #if HAVE_EVENTFD |