Project

General

Profile

Actions

Feature #11138

closed

[PATCH] ext/socket/init.c: use SOCK_NONBLOCK if available

Added by normalperson (Eric Wong) almost 9 years ago. Updated almost 9 years ago.

Status:
Closed
Target version:
-
[ruby-core:69129]

Description

[PATCH 1/2] ext/socket/init.c: use SOCK_NONBLOCK if available

This saves a system call by allowing us to use SOCK_NONBLOCK in
Linux when accept4 is available.

Note: I do not agree accept_nonblock should always make accepted
sockets non-blocking, and will propose a future API (next patch)
to allow controlling whether accepted sockets are non-blocking
or not regardless of how they were created.

  • ext/socket/init.c (cloexec_accept): support nonblock flag and
    use SOCK_NONBLOCK if possible
  • ext/socket/init.c (rsock_s_accept_nonblock): update cloexec_accept call
  • ext/socket/init.c (accept_blocking): ditto for blocking
  • test/socket/test_nonblock.rb: check nonblock? on accepted socket

Files

Actions

Also available in: Atom PDF

Like0
Like0