Date: Fri, 15 Feb 2002 20:14:50 -0800 (PST) From: Julian Elischer <julian@elischer.org> To: Magdalinin Kirill <bsdforumen@hotmail.com> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: a daemon C skeleton Message-ID: <Pine.BSF.4.21.0202152014030.39539-100000@InterJet.elischer.org> In-Reply-To: <F105Q0tArbDVL7IZQII0001fd3e@hotmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
> bsdforumen@hotmail.com
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
>
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0202152014030.39539-100000>
