try 
 ....
 daemon(....args..);
 .....

(man 3 daemon)


On Fri, 15 Feb 2002, 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
> 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to