Skip to content
Success

Changes

Summary

  1. Reimplement execvpe emulation in C (commit: e4d6448) (details)
  2. Test redirection of stdout and stderr to the same file descriptor (commit: 565c07c) (details)
  3. Detect availability of <spawn.h> and posix_spawn function (commit: 82af966) (details)
  4. Reimplement Unix.create_process in C, using posix_spawn if possible (commit: ba528fe) (details)
  5. Reimplement Unix.command like Unix.create_process (commit: 3e8272f) (details)
  6. Add Changes entry (commit: 2fe1677) (details)
Commit e4d64486cf5e6a975710e925470951465b66ec54 by xavier.leroy
Reimplement execvpe emulation in C

The `execvpe` function is not always provided by C standard libraries.

PR #1414 implemented an emulation of `execvpe` in terms of `execve`
written in OCaml.  This commit reimplements the emulation of `execvpe`
in C, so that it can be called from C.  It implements exactly the same
algorithm, with one small change detailed next.

Small change: error ENAMETOOLONG stops the search instead of
continuing with the next entry in PATH.  This seems more secure.
(commit: e4d6448)
The file was modifiedotherlibs/unix/execvp.c (diff)
The file was modifiedotherlibs/unix/unix.ml (diff)
Commit 565c07ceb0b27c1e8c2f1c437ab390690b77efee by xavier.leroy
Test redirection of stdout and stderr to the same file descriptor
(commit: 565c07c)
The file was modifiedtestsuite/tests/lib-unix/common/redirections.ml (diff)
The file was modifiedtestsuite/tests/lib-unix/common/redirections.reference (diff)
Commit 82af966ebd53d7488e9d6b3dfe37fb3510f4acbc by xavier.leroy
Detect availability of <spawn.h> and posix_spawn function
(commit: 82af966)
The file was modifiedruntime/caml/s.h.in (diff)
The file was modifiedconfigure (diff)
The file was modifiedconfigure.ac (diff)
Commit ba528fe7137a7e67c89a16dc47cfd932ee727210 by xavier.leroy
Reimplement Unix.create_process in C, using posix_spawn if possible

Unix.create_process was implemented in OCaml, using Unix.fork
and Unix.execvp.  This commit reimplements it in C, for several reasons:
- The implementation can take advantage of posix_spawn, if available,
  which is usually faster than fork + exec.
- The implementation is more atomic w.r.t. threading.
- Multicore OCaml will probably prohibit Unix.fork in multithreaded
  programs.
(commit: ba528fe)
The file was addedotherlibs/unix/spawn.c
The file was modifiedotherlibs/unix/Makefile (diff)
The file was modifiedotherlibs/unix/unix.ml (diff)
Commit 3e8272fe7ce86a75e296e81ca8dcf31e8307eb37 by xavier.leroy
Reimplement Unix.command like Unix.create_process

Avoid calling Unix.fork and use the new "spawn" primitive, for efficiency
and for improved compatibility with threads and Multicore OCaml.
(commit: 3e8272f)
The file was modifiedotherlibs/unix/unix.ml (diff)
The file was modifiedChanges (diff)