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

fix fork() usage in ocamltest #11111

Merged
merged 2 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,15 @@ Working version
Unix.readlink on Windows.
(David Allsopp, report by Xia Li-yao)


- #11077: Make dumpobj compatible with absence of naked pointer support
(Olivier Nicole and Jan Midtgaard, review by Gabriel Scherer)

- #11111: fix fork() usage in ocamltest C code.
When calling fork() from C code with the Multicore runtime active,
one needs to call caml_atfork_hook() on the forked child before it
can use the OCaml runtime.
(Gabriel Scherer, review by Xavier Leroy, report by Brahima Dibassi)

OCaml 4.14.0
----------------

Expand Down
3 changes: 3 additions & 0 deletions ocamltest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

ROOTDIR = ..

# enable debug info for run_*.c
CFLAGS=-g

include $(ROOTDIR)/Makefile.common
include $(ROOTDIR)/Makefile.best_binaries

Expand Down
2 changes: 2 additions & 0 deletions ocamltest/run_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include "run.h"
#include "run_common.h"
#include <caml/domain.h>

#define COREFILENAME "core"

Expand Down Expand Up @@ -346,6 +347,7 @@ int run_command(const command_settings *settings)
myperror("fork");
return -1;
case 0: /* child process */
caml_atfork_hook();
exit( run_command_child(settings) );
default:
return run_command_parent(settings, child_pid);
Expand Down