Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Unix subdaemon, channels, filedescriptors....
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-07-19 (13:08)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] Unix subdaemon, channels, filedescriptors....
> I am coding in Ocaml a daemon program (the Poesia monitor - see
> which happens to launch daemon
> subprocesses, i.e. it fork and execs processes which do not use their
> stdin stdout and stderr. Basically I would need something like a
> Unix.process_none which forks a command without any stdin stdout and
> stderr (which are technically redirected to /dev/null).

This can easily be written in terms of Unix.fork and Unix.exec; you
can use the sources for the Unix.process_* functions as a starting point.

> Also, Unix.open_process_in and related seems to forget closing the
> file descriptors in the child process, as this example (running only
> on Linux) demonstrates:

This is standard Unix behavior: file descriptors are preserved across
"exec", unless they were set to "close on exec" mode before the exec
(see Unix.set_close_on_exec).  

- Xavier Leroy
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: