… | |
… | |
1093 | return ts->tv_sec + ts->tv_nsec * 1e-9; |
1093 | return ts->tv_sec + ts->tv_nsec * 1e-9; |
1094 | } |
1094 | } |
1095 | |
1095 | |
1096 | /*****************************************************************************/ |
1096 | /*****************************************************************************/ |
1097 | |
1097 | |
|
|
1098 | /* extract a ref-to-array of strings into a temporary c style string vector */ |
|
|
1099 | static char ** |
|
|
1100 | extract_stringvec (SV *sv, const char *croakmsg) |
|
|
1101 | { |
|
|
1102 | if (!SvROK (sv) || SvTYPE (SvRV (sv)) != SVt_PVAV) |
|
|
1103 | croak (croakmsg); |
|
|
1104 | |
|
|
1105 | AV *av = (AV *)SvRV (sv); |
|
|
1106 | int i, nelem = av_len (av) + 1; |
|
|
1107 | char **vecp = (char **)SvPVX (sv_2mortal (newSV (sizeof (char *) * (nelem + 1)))); |
|
|
1108 | |
|
|
1109 | for (i = 0; i < nelem; ++i) |
|
|
1110 | { |
|
|
1111 | SV **e = av_fetch (av, i, 0); |
|
|
1112 | |
|
|
1113 | if (e && *e) |
|
|
1114 | vecp[i] = SvPVbyte_nolen (*e); |
|
|
1115 | else |
|
|
1116 | vecp[i] = ""; |
|
|
1117 | } |
|
|
1118 | |
|
|
1119 | vecp[nelem] = 0; |
|
|
1120 | |
|
|
1121 | return vecp; |
|
|
1122 | } |
|
|
1123 | |
|
|
1124 | /*****************************************************************************/ |
|
|
1125 | |
1098 | XS(boot_IO__AIO) ecb_cold; |
1126 | XS(boot_IO__AIO) ecb_cold; |
1099 | |
1127 | |
1100 | MODULE = IO::AIO PACKAGE = IO::AIO |
1128 | MODULE = IO::AIO PACKAGE = IO::AIO |
1101 | |
1129 | |
1102 | PROTOTYPES: ENABLE |
1130 | PROTOTYPES: ENABLE |
… | |
… | |
1311 | const_iv (EFD_SEMAPHORE) |
1339 | const_iv (EFD_SEMAPHORE) |
1312 | |
1340 | |
1313 | const_iv (MFD_CLOEXEC) |
1341 | const_iv (MFD_CLOEXEC) |
1314 | const_iv (MFD_ALLOW_SEALING) |
1342 | const_iv (MFD_ALLOW_SEALING) |
1315 | const_iv (MFD_HUGETLB) |
1343 | const_iv (MFD_HUGETLB) |
|
|
1344 | const_iv (MFD_HUGETLB_2MB) |
|
|
1345 | const_iv (MFD_HUGETLB_1GB) |
1316 | |
1346 | |
1317 | const_iv (CLOCK_REALTIME) |
1347 | const_iv (CLOCK_REALTIME) |
1318 | const_iv (CLOCK_MONOTONIC) |
1348 | const_iv (CLOCK_MONOTONIC) |
1319 | const_iv (CLOCK_BOOTTIME) |
1349 | const_iv (CLOCK_BOOTTIME) |
1320 | const_iv (CLOCK_REALTIME_ALARM) |
1350 | const_iv (CLOCK_REALTIME_ALARM) |
… | |
… | |
2681 | |
2711 | |
2682 | int |
2712 | int |
2683 | pidfd_send_signal (SV *pidfh, int sig, SV *siginfo = &PL_sv_undef, unsigned int flags = 0) |
2713 | pidfd_send_signal (SV *pidfh, int sig, SV *siginfo = &PL_sv_undef, unsigned int flags = 0) |
2684 | PPCODE: |
2714 | PPCODE: |
2685 | { |
2715 | { |
2686 | #if HAVE_SIGINFO_T |
|
|
2687 | int res; |
2716 | int res; |
|
|
2717 | #if HAVE_SIGINFO_T |
2688 | siginfo_t si = { 0 }; |
2718 | siginfo_t si = { 0 }; |
2689 | |
2719 | |
2690 | if (SvOK (siginfo)) |
2720 | if (SvOK (siginfo)) |
2691 | { |
2721 | { |
2692 | HV *hv; |
2722 | HV *hv; |
… | |
… | |
2704 | if ((svp = hv_fetchs (hv, "value_ptr", 0))) si.si_value.sival_ptr = (void *)SvIV (*svp); |
2734 | if ((svp = hv_fetchs (hv, "value_ptr", 0))) si.si_value.sival_ptr = (void *)SvIV (*svp); |
2705 | } |
2735 | } |
2706 | |
2736 | |
2707 | /*GENDEF0_SYSCALL(pidfd_send_signal,424)*/ |
2737 | /*GENDEF0_SYSCALL(pidfd_send_signal,424)*/ |
2708 | res = syscall (SYS_pidfd_send_signal, s_fileno_croak (pidfh, 0), sig, SvOK (siginfo) ? &si : 0, flags); |
2738 | res = syscall (SYS_pidfd_send_signal, s_fileno_croak (pidfh, 0), sig, SvOK (siginfo) ? &si : 0, flags); |
2709 | #else |
2739 | #else |
2710 | res = (errno = ENOSYS, -1); |
2740 | res = (errno = ENOSYS, -1); |
2711 | #endif |
2741 | #endif |
2712 | |
2742 | |
2713 | XPUSHs (sv_2mortal (newSViv (res))); |
2743 | XPUSHs (sv_2mortal (newSViv (res))); |
2714 | } |
2744 | } |
2715 | |
2745 | |
2716 | void |
2746 | void |
… | |
… | |
2806 | fd = (errno = ENOSYS, -1); |
2836 | fd = (errno = ENOSYS, -1); |
2807 | #endif |
2837 | #endif |
2808 | |
2838 | |
2809 | XPUSHs (newmortalFH (fd, O_RDWR)); |
2839 | XPUSHs (newmortalFH (fd, O_RDWR)); |
2810 | } |
2840 | } |
|
|
2841 | |
|
|
2842 | int |
|
|
2843 | fexecve (SV *fh, SV *args, SV *envs = &PL_sv_undef) |
|
|
2844 | CODE: |
|
|
2845 | { |
|
|
2846 | int fd = PerlIO_fileno (IoIFP (sv_2io (fh))); |
|
|
2847 | char **envp, **argv; |
|
|
2848 | argv = extract_stringvec (args, "IO::AIO::fexecve: args must be an array of strings"); |
|
|
2849 | if (!SvOK (envs)) |
|
|
2850 | { |
|
|
2851 | extern char **environ; |
|
|
2852 | envp = environ; |
|
|
2853 | } |
|
|
2854 | else |
|
|
2855 | envp = extract_stringvec (envs, "IO::AIO::fexecve: envs must be an array of strings"); |
|
|
2856 | #if _POSIX_VERSION >= 200809L |
|
|
2857 | RETVAL = fexecve (fd, argv, envp); |
|
|
2858 | #else |
|
|
2859 | RETVAL = (errno = ENOSYS, -1); |
|
|
2860 | #endif |
|
|
2861 | } |
|
|
2862 | OUTPUT: RETVAL |
2811 | |
2863 | |
2812 | UV |
2864 | UV |
2813 | get_fdlimit () |
2865 | get_fdlimit () |
2814 | CODE: |
2866 | CODE: |
2815 | #if HAVE_RLIMITS |
2867 | #if HAVE_RLIMITS |