… | |
… | |
2495 | RETVAL = 0; |
2495 | RETVAL = 0; |
2496 | #endif |
2496 | #endif |
2497 | OUTPUT: |
2497 | OUTPUT: |
2498 | RETVAL |
2498 | RETVAL |
2499 | |
2499 | |
2500 | int |
2500 | void |
|
|
2501 | accept4 (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 | |
|
|
2533 | ssize_t |
2501 | 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) |
2502 | CODE: |
2535 | CODE: |
2503 | { |
2536 | { |
2504 | #if HAVE_LINUX_SPLICE |
2537 | #if HAVE_LINUX_SPLICE |
2505 | loff_t off_in_, off_out_; |
2538 | loff_t off_in_, off_out_; |
… | |
… | |
2513 | #endif |
2546 | #endif |
2514 | } |
2547 | } |
2515 | OUTPUT: |
2548 | OUTPUT: |
2516 | RETVAL |
2549 | RETVAL |
2517 | |
2550 | |
2518 | int |
2551 | ssize_t |
2519 | 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) |
2520 | CODE: |
2553 | CODE: |
2521 | #if HAVE_LINUX_SPLICE |
2554 | #if HAVE_LINUX_SPLICE |
2522 | RETVAL = tee (rfh, wfh, length, flags); |
2555 | RETVAL = tee (rfh, wfh, length, flags); |
2523 | #else |
2556 | #else |
… | |
… | |
2703 | for (bit = 0x40000000U; bit; bit >>= 1) |
2736 | for (bit = 0x40000000U; bit; bit >>= 1) |
2704 | { |
2737 | { |
2705 | rl.rlim_max |= bit; |
2738 | rl.rlim_max |= bit; |
2706 | rl.rlim_cur = rl.rlim_max; |
2739 | rl.rlim_cur = rl.rlim_max; |
2707 | |
2740 | |
2708 | /* nevr decrease the hard limit */ |
2741 | /* never decrease the hard limit */ |
2709 | if (rl.rlim_max < orig_rlim_max) |
2742 | if (rl.rlim_max < orig_rlim_max) |
2710 | break; |
2743 | break; |
2711 | |
2744 | |
2712 | if (0 != setrlimit (RLIMIT_NOFILE, &rl)) |
2745 | if (0 != setrlimit (RLIMIT_NOFILE, &rl)) |
2713 | rl.rlim_max &= ~bit; /* too high, remove bit again */ |
2746 | rl.rlim_max &= ~bit; /* too high, remove bit again */ |