Project

General

Profile

Feature #11138

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

Added by normalperson (Eric Wong) about 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
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

#1

Updated by Anonymous about 5 years ago

  • Status changed from Open to Closed

Applied in changeset r50518.


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 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 [Feature #11138]

Also available in: Atom PDF