Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing support for SOCK_NONBLOCK and SOCK_CLOEXEC #6947

Closed
vicuna opened this issue Jul 31, 2015 · 2 comments
Closed

Missing support for SOCK_NONBLOCK and SOCK_CLOEXEC #6947

vicuna opened this issue Jul 31, 2015 · 2 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented Jul 31, 2015

Original bug ID: 6947
Reporter: goswin
Assigned to: @mshinwell
Status: resolved (set by @mshinwell on 2017-03-07T11:55:26Z)
Resolution: fixed
Priority: normal
Severity: minor
Platform: Linux
Version: 4.01.0
Target version: later
Fixed in version: 4.05.0 +dev/beta1/beta2/beta3/rc1
Category: otherlibs
Related to: #5256

Bug description

From 'man 2 socket':

   Since Linux 2.6.27, the type argument serves a second purpose: in addi-
   tion  to specifying a socket type, it may include the bitwise OR of any
   of the following values, to modify the behavior of socket():

   SOCK_NONBLOCK   Set the O_NONBLOCK file status flag  on  the  new  open
                   file description.  Using this flag saves extra calls to
                   fcntl(2) to achieve the same result.

   SOCK_CLOEXEC    Set the close-on-exec (FD_CLOEXEC) flag on the new file
                   descriptor.   See the description of the O_CLOEXEC flag
                   in open(2) for reasons why this may be useful.

In C those flags are combined with the type. In ocaml the type is a variant type so that won't work. But they could be added as optional arguments.

@vicuna
Copy link
Author

vicuna commented Nov 16, 2015

Comment author: @xavierleroy

The nonstandard CLOEXEC flags are part of the more general discussion in #5256 (on ensuring that file descriptors don't leak during fork()).

I don't see a pressing need for SOCK_NONBLOCK, as equivalent behavior can be obtained portably by setting nonblock after the FD is created.

@vicuna
Copy link
Author

vicuna commented Mar 7, 2017

Comment author: @mshinwell

I agree that implementing SOCK_NONBLOCK doesn't seem worth the time spent. The close-on-exec option has been implemented in #5256, which has been fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants