Re: How do I daemonize a process?



On Mon, Jul 23, 2007 at 01:41:00AM -0700, Garrett Cooper wrote:
Garrett Cooper wrote:
As the subject suggests I'm trying to determine how I can daemonize
a C process, outside of using the rc infrastructure, so that it won't
exit when the TTY exists. Does anyone know any quick references or
examples?
Thanks,
-Garrett

s/C process/C application process/
s/exists/exits/
s/any quick/of any quick/

Tonight's not my night for communicating I suppose :(..
-Garrett
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"

If you can modify the source, have a look at the daemon() function :
man 3 daemon

jacques
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: __put_task_struct unresolved when being used in modules
    ... >> In general module shouldn't deal with task reference counts. ... >> you have a legitimate reason for doing this from a module after a review ... > need to send a signal to that daemon, ... Drivers should not be holding references to userspace processes. ...
    (Linux-Kernel)
  • Re: how to find the current tty?
    ... Andrej Hocevar wrote: ... >> A daemon doesn't usually have a current tty, so what are you expecting to ... >tty the user is currently using. ...
    (comp.unix.programmer)
  • Re: how to find the current tty?
    ... >> A daemon doesn't usually have a current tty, so what are you expecting ... it only works for the console I start ... > tty the user is currently using. ...
    (comp.unix.programmer)
  • Re: Daemon: setgid Operation not permitted
    ... The short answer is that a daemon conceptually should not be ... It's much the same reason that a well-behaved daemon closes unneeded ... but then why fork once or twice instead of just ignoring SIGHUP? ... connected to a tty it will not be using. ...
    (comp.unix.programmer)
  • Re: daemon and the controlling terminal
    ... An important reason that a daemon has to lose the controlling terminal ... is that the process group associated with that tty gets signals -- ... if (fork()!= 0) ...
    (comp.unix.programmer)