<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2002/07/85bf00d0b31dc09005c79719c1be9ec6"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-19T13:08:12"
  subject="Re: [Caml-list] Unix subdaemon, channels, filedescriptors...."
  prev="2002/07/4e344307419808f13975d9232ec23d56"
  next="2002/07/ac4e05831f30ed07b9b02d83271c6c04"
  prev-in-thread="2002/07/6df64d244fa3841b6464fe19614fa87c"
  prev-thread="2002/07/e97792a8a64614e000b7a7096a57651b"
  next-thread="2002/07/fe9646fa169c9ecb8e15a547bbb95c87"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Unix subdaemon, channels, filedescriptors....">
<msg 
  url="2002/07/6f9d163bb49127c0bf96895d22c05290"
  from="Basile STARYNKEVITCH &lt;basile.starynkevitch@c...&gt;"
  author="Basile STARYNKEVITCH"
  date="2002-07-17T14:07:25"
  subject="[Caml-list] Unix subdaemon, channels, filedescriptors....">
<msg 
  url="2002/07/6df64d244fa3841b6464fe19614fa87c"
  from="Bruno.Verlyck@i..."
  author="Bruno.Verlyck@i..."
  date="2002-07-17T16:05:24"
  subject="Re: [Caml-list] Unix subdaemon, channels, filedescriptors....">
</msg>
<msg 
  url="2002/07/85bf00d0b31dc09005c79719c1be9ec6"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-19T13:08:12"
  subject="Re: [Caml-list] Unix subdaemon, channels, filedescriptors....">
</msg>
</msg>
</thread>

<contents>
&gt; I am coding in Ocaml a daemon program (the Poesia monitor - see
&gt; http://www.poesia-filter.org/) which happens to launch daemon
&gt; subprocesses, i.e. it fork and execs processes which do not use their
&gt; stdin stdout and stderr. Basically I would need something like a
&gt; Unix.process_none which forks a command without any stdin stdout and
&gt; 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.

&gt; Also, Unix.open_process_in and related seems to forget closing the
&gt; file descriptors in the child process, as this example (running only
&gt; 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

</contents>

</message>

