ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/AIO.xs
(Generate patch)

Comparing IO-AIO/AIO.xs (file contents):
Revision 1.275 by root, Mon Mar 18 23:52:09 2019 UTC vs.
Revision 1.282 by root, Wed Feb 26 15:49:25 2020 UTC

1195 const_iv (MAP_STACK) 1195 const_iv (MAP_STACK)
1196 1196
1197 const_iv (MREMAP_MAYMOVE) 1197 const_iv (MREMAP_MAYMOVE)
1198 const_iv (MREMAP_FIXED) 1198 const_iv (MREMAP_FIXED)
1199 1199
1200 const_iv (F_DUPFD_CLOEXEC)
1201
1202 const_iv (MSG_CMSG_CLOEXEC) 1200 const_iv (MSG_CMSG_CLOEXEC)
1203 const_iv (SOCK_CLOEXEC) 1201 const_iv (SOCK_CLOEXEC)
1202
1203 const_iv (F_DUPFD_CLOEXEC)
1204
1205 const_iv (F_ADD_SEALS)
1206 const_iv (F_GET_SEALS)
1207 const_iv (F_SEAL_SEAL)
1208 const_iv (F_SEAL_SHRINK)
1209 const_iv (F_SEAL_GROW)
1210 const_iv (F_SEAL_WRITE)
1204 1211
1205 const_iv (F_OFD_GETLK) 1212 const_iv (F_OFD_GETLK)
1206 const_iv (F_OFD_SETLK) 1213 const_iv (F_OFD_SETLK)
1207 const_iv (F_OFD_GETLKW) 1214 const_iv (F_OFD_GETLKW)
1208 1215
1284 const_iv (SPLICE_F_GIFT) 1291 const_iv (SPLICE_F_GIFT)
1285 1292
1286 const_iv (EFD_CLOEXEC) 1293 const_iv (EFD_CLOEXEC)
1287 const_iv (EFD_NONBLOCK) 1294 const_iv (EFD_NONBLOCK)
1288 const_iv (EFD_SEMAPHORE) 1295 const_iv (EFD_SEMAPHORE)
1296
1297 const_iv (MFD_CLOEXEC)
1298 const_iv (MFD_ALLOW_SEALING)
1299 const_iv (MFD_HUGETLB)
1289 1300
1290 const_iv (CLOCK_REALTIME) 1301 const_iv (CLOCK_REALTIME)
1291 const_iv (CLOCK_MONOTONIC) 1302 const_iv (CLOCK_MONOTONIC)
1292 const_iv (CLOCK_BOOTTIME) 1303 const_iv (CLOCK_BOOTTIME)
1293 const_iv (CLOCK_REALTIME_ALARM) 1304 const_iv (CLOCK_REALTIME_ALARM)
2484 RETVAL = 0; 2495 RETVAL = 0;
2485#endif 2496#endif
2486 OUTPUT: 2497 OUTPUT:
2487 RETVAL 2498 RETVAL
2488 2499
2489int 2500void
2501accept4 (aio_rfd rfh, SV *sockaddr, int salen, int flags)
2502 PPCODE:
2503{
2504 SV *retval;
2505#if HAVE_ACCEPT4
2506 socklen_t salen_ = salen ? salen + 1 : 0;
2507
2508 if (salen)
2509 {
2510 sv_upgrade (sockaddr, SVt_PV);
2511 sv_grow (sockaddr, salen_);
2512 }
2513
2514 int res = accept4 (rfh, salen ? (struct sockaddr *)SvPVX (sockaddr) : 0, salen ? &salen_ : 0, flags);
2515
2516 retval = newmortalFH (res, O_RDWR);
2517
2518 if (res >= 0 && salen > 0)
2519 {
2520 if (salen_ > salen + 1)
2521 salen_ = salen + 1;
2522
2523 SvPOK_only (sockaddr);
2524 SvCUR_set (sockaddr, salen_);
2525 }
2526#else
2527 errno = ENOSYS;
2528 retval = &PL_sv_undef;
2529#endif
2530 XPUSHs (retval);
2531}
2532
2533ssize_t
2490splice (aio_rfd rfh, SV *off_in, aio_wfd wfh, SV *off_out, size_t length, unsigned int flags) 2534splice (aio_rfd rfh, SV *off_in, aio_wfd wfh, SV *off_out, size_t length, unsigned int flags)
2491 CODE: 2535 CODE:
2492{ 2536{
2493#if HAVE_LINUX_SPLICE 2537#if HAVE_LINUX_SPLICE
2494 loff_t off_in_, off_out_; 2538 loff_t off_in_, off_out_;
2502#endif 2546#endif
2503} 2547}
2504 OUTPUT: 2548 OUTPUT:
2505 RETVAL 2549 RETVAL
2506 2550
2507int 2551ssize_t
2508tee (aio_rfd rfh, aio_wfd wfh, size_t length, unsigned int flags) 2552tee (aio_rfd rfh, aio_wfd wfh, size_t length, unsigned int flags)
2509 CODE: 2553 CODE:
2510#if HAVE_LINUX_SPLICE 2554#if HAVE_LINUX_SPLICE
2511 RETVAL = tee (rfh, wfh, length, flags); 2555 RETVAL = tee (rfh, wfh, length, flags);
2512#else 2556#else
2627#else 2671#else
2628 errno = ENOSYS; 2672 errno = ENOSYS;
2629#endif 2673#endif
2630} 2674}
2631 2675
2676void
2677memfd_create (SV8 *pathname, int flags = 0)
2678 PPCODE:
2679{
2680 int fd;
2681#if HAVE_MEMFD_CREATE
2682 fd = memfd_create (SvPVbyte_nolen (pathname), flags);
2683#else
2684 fd = (errno = ENOSYS, -1);
2685#endif
2686
2687 XPUSHs (newmortalFH (fd, O_RDWR));
2688}
2689
2632UV 2690UV
2633get_fdlimit () 2691get_fdlimit ()
2634 CODE: 2692 CODE:
2635#if HAVE_RLIMITS 2693#if HAVE_RLIMITS
2636 struct rlimit rl; 2694 struct rlimit rl;
2669 if (0 == setrlimit (RLIMIT_NOFILE, &rl)) 2727 if (0 == setrlimit (RLIMIT_NOFILE, &rl))
2670 XSRETURN_YES; 2728 XSRETURN_YES;
2671 2729
2672 if (errno == EPERM) 2730 if (errno == EPERM)
2673 { 2731 {
2674 /* setlimit failed with EPERM - maybe we can't raise the hardlimit, or maybe */ 2732 /* setrlimit failed with EPERM - maybe we can't raise the hardlimit, or maybe */
2675 /* our limit overflows a system-wide limit */ 2733 /* our limit overflows a system-wide limit */
2676 /* try an adaptive algorithm, but do not lower the hardlimit */ 2734 /* try an adaptive algorithm, but do not lower the hardlimit */
2677 rl.rlim_max = 0; 2735 rl.rlim_max = 0;
2678 for (bit = 0x40000000U; bit; bit >>= 1) 2736 for (bit = 0x40000000U; bit; bit >>= 1)
2679 { 2737 {
2680 rl.rlim_max |= bit; 2738 rl.rlim_max |= bit;
2681 rl.rlim_cur = rl.rlim_max; 2739 rl.rlim_cur = rl.rlim_max;
2682 2740
2683 /* nevr decrease the hard limit */ 2741 /* never decrease the hard limit */
2684 if (rl.rlim_max < orig_rlim_max) 2742 if (rl.rlim_max < orig_rlim_max)
2685 break; 2743 break;
2686 2744
2687 if (0 != setrlimit (RLIMIT_NOFILE, &rl)) 2745 if (0 != setrlimit (RLIMIT_NOFILE, &rl))
2688 rl.rlim_max &= ~bit; /* too high, remove bit again */ 2746 rl.rlim_max &= ~bit; /* too high, remove bit again */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines