man 3 daemon
On Fri, Feb 15, 2002 at 11:52:22AM +0300, Magdalinin Kirill wrote:
> Hello,
>
> can anyone, please, point out a C skeleton for FreeBSD daemon.
> Is the following simple example correct for FreeBSD?
>
> if (getppid() != 1)
> {
> signal(SIGTTOU, SIG_IGN);
> signal(SIGTTIN, SIG_IGN);
> signal(SIGTSTP, SIG_IGN);
>
> if (fork() != 0)
> exit(0);
>
> setsid();
> }
>
> getrlimit(RLIMIT_NOFILE, &flim);
> for (fd = 0; fd < flim.rlim_max; fd++)
> close(fd);
>
> chdir("/");
>
> .....
>
>
>
> thanks in advance,
>
> Kirill Magdalinin
> [EMAIL PROTECTED]
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
>
>
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message
--
Mark Santcroos RIPE Network Coordination Centre
http://www.ripe.net/home/mark/ New Projects Group/TTM
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message