Issue #11138 has been reported by Eric Wong.

----------------------------------------
Feature #11138: [PATCH] ext/socket/init.c: use SOCK_NONBLOCK if available
https://bugs.ruby-lang.org/issues/11138

* Author: Eric Wong
* Status: Open
* Priority: Normal
* Assignee: Akira Tanaka
----------------------------------------
[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--------------------------------
0001-ext-socket-init.c-use-SOCK_NONBLOCK-if-available.patch (3.83 KB)


-- 
https://bugs.ruby-lang.org/