… | |
… | |
227 | |
227 | |
228 | #if PAGESIZE <= 0 |
228 | #if PAGESIZE <= 0 |
229 | # define PAGESIZE sysconf (_SC_PAGESIZE) |
229 | # define PAGESIZE sysconf (_SC_PAGESIZE) |
230 | #endif |
230 | #endif |
231 | |
231 | |
|
|
232 | /* solaris perl seems to declare a wrong syscall function that clashes with system includes */ |
|
|
233 | #ifdef __sun |
|
|
234 | # undef HAVE_SYSCALL |
|
|
235 | #endif |
|
|
236 | |
232 | #if HAVE_SYSCALL |
237 | #if HAVE_SYSCALL |
233 | #include <sys/syscall.h> |
238 | #include <sys/syscall.h> |
234 | #else |
239 | #else |
235 | # define syscall(nr,...) (errno = ENOSYS, -1) |
240 | # define syscall(nr,...) (errno = ENOSYS, -1) |
236 | #endif |
241 | #endif |
… | |
… | |
1198 | const_iv (MAP_NONBLOCK) |
1203 | const_iv (MAP_NONBLOCK) |
1199 | const_iv (MAP_GROWSDOWN) |
1204 | const_iv (MAP_GROWSDOWN) |
1200 | const_iv (MAP_32BIT) |
1205 | const_iv (MAP_32BIT) |
1201 | const_iv (MAP_HUGETLB) |
1206 | const_iv (MAP_HUGETLB) |
1202 | const_iv (MAP_STACK) |
1207 | const_iv (MAP_STACK) |
|
|
1208 | const_iv (MAP_FIXED_NOREPLACE) |
|
|
1209 | const_iv (MAP_SHARED_VALIDATE) |
|
|
1210 | const_iv (MAP_SYNC) |
|
|
1211 | const_iv (MAP_UNINITIALIZED) |
1203 | |
1212 | |
1204 | const_iv (MREMAP_MAYMOVE) |
1213 | const_iv (MREMAP_MAYMOVE) |
1205 | const_iv (MREMAP_FIXED) |
1214 | const_iv (MREMAP_FIXED) |
1206 | |
1215 | |
1207 | const_iv (MSG_CMSG_CLOEXEC) |
1216 | const_iv (MSG_CMSG_CLOEXEC) |
… | |
… | |
2673 | int |
2682 | int |
2674 | pidfd_send_signal (SV *pidfh, int sig, SV *siginfo = &PL_sv_undef, unsigned int flags = 0) |
2683 | pidfd_send_signal (SV *pidfh, int sig, SV *siginfo = &PL_sv_undef, unsigned int flags = 0) |
2675 | PPCODE: |
2684 | PPCODE: |
2676 | { |
2685 | { |
2677 | int res; |
2686 | int res; |
|
|
2687 | #if HAVE_SIGINFO_T |
2678 | siginfo_t si = { 0 }; |
2688 | siginfo_t si = { 0 }; |
2679 | |
2689 | |
2680 | if (SvOK (siginfo)) |
2690 | if (SvOK (siginfo)) |
2681 | { |
2691 | { |
2682 | HV *hv; |
2692 | HV *hv; |
2683 | SV **svp; |
2693 | SV **svp; |
2684 | |
2694 | |
2685 | if (!SvROK (siginfo) || SvTYPE (SvRV (siginfo)) != SVt_PVHV) |
2695 | 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"); |
2696 | croak ("siginfo argument must be a hashref with 'code', 'pid', 'uid' and 'value_int' or 'value_ptr' members, caught"); |
2687 | |
2697 | |
2688 | hv = (HV *)SvRV (siginfo); |
2698 | hv = (HV *)SvRV (siginfo); |
2689 | |
2699 | |
2690 | if ((svp = hv_fetchs (hv, "code" , 0))) si.si_code = SvIV (*svp); |
2700 | 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); |
2701 | if ((svp = hv_fetchs (hv, "pid" , 0))) si.si_pid = SvIV (*svp); |
… | |
… | |
2694 | if ((svp = hv_fetchs (hv, "value_ptr", 0))) si.si_value.sival_ptr = (void *)SvIV (*svp); |
2704 | if ((svp = hv_fetchs (hv, "value_ptr", 0))) si.si_value.sival_ptr = (void *)SvIV (*svp); |
2695 | } |
2705 | } |
2696 | |
2706 | |
2697 | /*GENDEF0_SYSCALL(pidfd_send_signal,424)*/ |
2707 | /*GENDEF0_SYSCALL(pidfd_send_signal,424)*/ |
2698 | res = syscall (SYS_pidfd_send_signal, s_fileno_croak (pidfh, 0), sig, SvOK (siginfo) ? &si : 0, flags); |
2708 | res = syscall (SYS_pidfd_send_signal, s_fileno_croak (pidfh, 0), sig, SvOK (siginfo) ? &si : 0, flags); |
|
|
2709 | #else |
|
|
2710 | res = (errno = ENOSYS, -1); |
|
|
2711 | #endif |
2699 | |
2712 | |
2700 | XPUSHs (sv_2mortal (newSViv (res))); |
2713 | XPUSHs (sv_2mortal (newSViv (res))); |
2701 | } |
2714 | } |
2702 | |
2715 | |
2703 | void |
2716 | void |