… | |
… | |
2512 | } |
2512 | } |
2513 | |
2513 | |
2514 | int res = accept4 (rfh, salen ? (struct sockaddr *)SvPVX (sockaddr) : 0, salen ? &salen_ : 0, flags); |
2514 | int res = accept4 (rfh, salen ? (struct sockaddr *)SvPVX (sockaddr) : 0, salen ? &salen_ : 0, flags); |
2515 | |
2515 | |
2516 | retval = newmortalFH (res, O_RDWR); |
2516 | retval = newmortalFH (res, O_RDWR); |
2517 | sv_dump(retval); |
|
|
2518 | |
2517 | |
2519 | if (res >= 0 && salen > 0) |
2518 | if (res >= 0 && salen > 0) |
2520 | { |
2519 | { |
2521 | if (salen_ > salen + 1) |
2520 | if (salen_ > salen + 1) |
2522 | salen_ = salen + 1; |
2521 | salen_ = salen + 1; |
… | |
… | |
2529 | retval = &PL_sv_undef; |
2528 | retval = &PL_sv_undef; |
2530 | #endif |
2529 | #endif |
2531 | XPUSHs (retval); |
2530 | XPUSHs (retval); |
2532 | } |
2531 | } |
2533 | |
2532 | |
2534 | int |
2533 | ssize_t |
2535 | splice (aio_rfd rfh, SV *off_in, aio_wfd wfh, SV *off_out, size_t length, unsigned int flags) |
2534 | splice (aio_rfd rfh, SV *off_in, aio_wfd wfh, SV *off_out, size_t length, unsigned int flags) |
2536 | CODE: |
2535 | CODE: |
2537 | { |
2536 | { |
2538 | #if HAVE_LINUX_SPLICE |
2537 | #if HAVE_LINUX_SPLICE |
2539 | loff_t off_in_, off_out_; |
2538 | loff_t off_in_, off_out_; |
… | |
… | |
2547 | #endif |
2546 | #endif |
2548 | } |
2547 | } |
2549 | OUTPUT: |
2548 | OUTPUT: |
2550 | RETVAL |
2549 | RETVAL |
2551 | |
2550 | |
2552 | int |
2551 | ssize_t |
2553 | tee (aio_rfd rfh, aio_wfd wfh, size_t length, unsigned int flags) |
2552 | tee (aio_rfd rfh, aio_wfd wfh, size_t length, unsigned int flags) |
2554 | CODE: |
2553 | CODE: |
2555 | #if HAVE_LINUX_SPLICE |
2554 | #if HAVE_LINUX_SPLICE |
2556 | RETVAL = tee (rfh, wfh, length, flags); |
2555 | RETVAL = tee (rfh, wfh, length, flags); |
2557 | #else |
2556 | #else |
… | |
… | |
2728 | if (0 == setrlimit (RLIMIT_NOFILE, &rl)) |
2727 | if (0 == setrlimit (RLIMIT_NOFILE, &rl)) |
2729 | XSRETURN_YES; |
2728 | XSRETURN_YES; |
2730 | |
2729 | |
2731 | if (errno == EPERM) |
2730 | if (errno == EPERM) |
2732 | { |
2731 | { |
2733 | /* 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 */ |
2734 | /* our limit overflows a system-wide limit */ |
2733 | /* our limit overflows a system-wide limit */ |
2735 | /* try an adaptive algorithm, but do not lower the hardlimit */ |
2734 | /* try an adaptive algorithm, but do not lower the hardlimit */ |
2736 | rl.rlim_max = 0; |
2735 | rl.rlim_max = 0; |
2737 | for (bit = 0x40000000U; bit; bit >>= 1) |
2736 | for (bit = 0x40000000U; bit; bit >>= 1) |
2738 | { |
2737 | { |
2739 | rl.rlim_max |= bit; |
2738 | rl.rlim_max |= bit; |
2740 | rl.rlim_cur = rl.rlim_max; |
2739 | rl.rlim_cur = rl.rlim_max; |
2741 | |
2740 | |
2742 | /* nevr decrease the hard limit */ |
2741 | /* never decrease the hard limit */ |
2743 | if (rl.rlim_max < orig_rlim_max) |
2742 | if (rl.rlim_max < orig_rlim_max) |
2744 | break; |
2743 | break; |
2745 | |
2744 | |
2746 | if (0 != setrlimit (RLIMIT_NOFILE, &rl)) |
2745 | if (0 != setrlimit (RLIMIT_NOFILE, &rl)) |
2747 | rl.rlim_max &= ~bit; /* too high, remove bit again */ |
2746 | rl.rlim_max &= ~bit; /* too high, remove bit again */ |