Date: Fri, 15 Feb 2002 09:58:35 +0100 From: Mark Santcroos <marks@ripe.net> To: Magdalinin Kirill <bsdforumen@hotmail.com> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: a daemon C skeleton Message-ID: <20020215095835.A57920@laptop.6bone.nl> In-Reply-To: <F105Q0tArbDVL7IZQII0001fd3e@hotmail.com>; from bsdforumen@hotmail.com on Fri, Feb 15, 2002 at 11:52:22AM %2B0300 References: <F105Q0tArbDVL7IZQII0001fd3e@hotmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
> 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
--
Mark Santcroos RIPE Network Coordination Centre
http://www.ripe.net/home/mark/ New Projects Group/TTM
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?20020215095835.A57920>
