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

Cliff Stanford cliff at may.be
Wed Nov 5 19:45:42 EST 2008

Jonathan Pryor wrote:

> So a "better" approach would be to look for the -d flag, and if present
> detach from the controlling terminal (forget what it is), respawn the
> current process via System.Diagnostics.Process w/o the -d flag, then
> exit.  This sill create a child process that isn't attached to a
> terminal, thus doing (with more work) what daemon(3) would do...

I don't want to turn this into a language argument but my feeling was
that mono was allowing C# to become a serious Unix programming language.

Taking your approach above, I can't open sockets and files and pass them
onto the daemon.  Indeed, it would be simpler to write a C or Perl
wrapper to achieve the above but that would (a) be a shame and (b) still
not allow open file handles to be passed on (other than stdin, stdout
and stderr).

Becoming a daemon is a common part of Unix programming.  I don't know
anything about the Mono internals but it seems to me that there should
be some way to achieve it.  The Service paradigm, whilst great for
porting of Windows code, just isn't what is needed for true Unix

Even if it's not possible to achieve what I'm trying to do today, I hope
I've planted a seed of thought in the Mono developers' minds.


Cliff Stanford
Might Limited                           +44 845 0045 666 (Office)
Suite 67, Dorset House                  +44 7973 616 666 (Mobile)
Duke Street, Chelmsford, CM1 1TB

More information about the Mono-devel-list mailing list