-
Notifications
You must be signed in to change notification settings - Fork 177
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
Add ?cloexec parameter to Lwt_unix functions that create file descriptors #327
Milestone
Comments
I'm closing this issue for now, because:
We can reopen and fix later, if necessary. Here's a link to text about the issue in module |
MisterDA
added a commit
to MisterDA/lwt
that referenced
this issue
Nov 9, 2021
In the Lwt_unix module, add `?cloexec:bool` optional arguments to functions that create file descriptors (`dup`, `dup2`, `pipe`, `pipe_in`, `pipe_out`, `socket`, `socketpair`, `accept`, `accept_n`). The `?cloexec` argument is simply forwarded to the wrapped Unix function (with OCaml >= 4.05, see [ocaml/ocaml#650][650]), or emulated as best-effort with `Unix.set_close_on_exec` on older OCaml versions. Fix ocsigen#327. Fix ocsigen#847. See also ocsigen#872. [650]: ocaml/ocaml#650
smorimoto
pushed a commit
to raphael-proust/lwt
that referenced
this issue
Dec 2, 2021
In the Lwt_unix module, add `?cloexec:bool` optional arguments to functions that create file descriptors (`dup`, `dup2`, `pipe`, `pipe_in`, `pipe_out`, `socket`, `socketpair`, `accept`, `accept_n`). The `?cloexec` argument is simply forwarded to the wrapped Unix function (with OCaml >= 4.05, see [ocaml/ocaml#650][650]), or emulated as best-effort with `Unix.set_close_on_exec` on older OCaml versions. Fix ocsigen#327. Fix ocsigen#847. See also ocsigen#872. [650]: ocaml/ocaml#650
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OCaml 4.05 adds an optional
cloexec
parameter to several Unix functions, allowing the close-on-exec flag to be set as the operation is performed atomically on some platforms (limited to Linux atm.) -- otherwise there's a race condition when there are multiple (system) threads.These functions would be affected:
Lwt_unix.dup
,dup2
,pipe
,socket
,socketpair
,accept
.Other functions that build on them and could also take
?cloexec
:accept_n
,pipe_in
,pipe_out
.The text was updated successfully, but these errors were encountered: