[Mono-dev] System.Unix.Native.Syscall.fork is commented out

Avery Pennarun apenwarr at gmail.com
Wed Sep 3 01:02:33 EDT 2008

On Wed, Sep 3, 2008 at 12:16 AM, Bojan Rajkovic <bojanr at brandeis.edu> wrote:
>> I'm attempting to write a simple daemon in mono that should
>> background
>> itself after starting correctly.  Essentially, it should fork() and
>> then the parent should exit(0) while the child process continues.
> I believe you can use mono-service and the usual Windows service stuff in the
> ServiceProcess assembly. Check http://www.go-mono.com/docs/index.aspx?link=man%3Amono-service(1)
> for more info, and hopefully someone will be able to give more detail than
> I have.

Well, yes, I've used mono-service a bit, but it seems a bit
heavyweight and weird, mostly because Windows's service API is
heavyweight and weird.  Sometimes you just want to fork.

What I'm trying to do here specifically is to start a program, have it
open its listening socket, then fork into the background so the parent
process can launch *another* process with the certainty that the
listening socket is already open.  Then I want to be able to kill the
process (and all its potential children) safely afterwards.  Basically
it's for a unit test, so multiple users might be starting/stopping
these processes on the same machine simultaneously.  It doesn't seem
like the heavyweight MS service API is really cut out for this kind of

Thanks for the link, though.  I suppose mono-service is usually the
"right" way to fork into the background.

Have fun,


More information about the Mono-devel-list mailing list