Browse thread
[Caml-list] different behaviour of Unix.fork on FreeBSD and Linux
-
Beck01, Wolfgang
- Remi Vanicat
- John Carr
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | John Carr <jfc@M...> |
| Subject: | Re: [Caml-list] different behaviour of Unix.fork on FreeBSD and Linux |
fork duplicates the buffers holding output that has not yet been written to a file descriptor. If the output buffer is not empty at the time of fork, output may be duplicated. If output is unbuffered or line buffered the program will work as in the BSD case. Otherwise you need to arrange for buffered output to be written before fork(). In C one is advised to call fflush(NULL) before fork if the child does I/O. If the child calls exec() immediately _exit() should be used instead of exit() if the exec() fails. (_exit() terminates the process without flushing I/O buffers.) ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners