Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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
> http://www.poesia-filter.org/) 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 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