Article View: news.software.nntp
Article #23567Re: nnrpd size with actived
From: Dan Foster
Date: Sun, 23 Nov 1997 00:00
Date: Sun, 23 Nov 1997 00:00
59 lines
2335 bytes
2335 bytes
In article <347903c2.229709887@zeppelin.home.net>,
Trevor Fiatal <trevor@home.net> wrote:
>>I also added a setsid() to detach it from the terminal (solaris 251) as it
>>wasn't doing that by itself.
>>
>>I'm running insync's patch cocktail -- not sure if your patch is in that or
>>not.
>
>Any chance you could diff your version against the distributed copy of the
>actived source? I've been meaning to look into why it wouldn't detach
>properly on my Solaris 2.5.1 boxen, but I haven't had time, so this would be a
>huge help.
....or you could use the daemon() function that I grabbed from FreeBSD's
libc sources, put the function in daemon.c, add daemon.c and daemon.o to
appropriate Makefile lines, and rebuild. It then built out of the box (and
worked just dandy) on my SysV-based AIX v4 box.
-Dan
daemon.c:
#include <fcntl.h>
#include <paths.h>
#include <unistd.h>
int
daemon(nochdir, noclose)
int nochdir, noclose;
{
int fd;
switch (fork()) {
case -1:
return (-1);
case 0:
break;
default:
_exit(0);
}
if (setsid() == -1)
return (-1);
if (!nochdir)
(void)chdir("/");
if (!noclose && (fd = open("/dev/null", O_RDWR, 0)) != -1) {
(void)dup2(fd, STDIN_FILENO);
(void)dup2(fd, STDOUT_FILENO);
(void)dup2(fd, STDERR_FILENO);
if (fd > 2)
(void)close (fd);
}
return (0);
}
Technical Details
Message-ID:
<659ogv$qf2$1@node6.frontiernet.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<347617F5.1877B783@netreach.nospam.net> <656vfo$prc$1@earth.execpc.com> <34773FEA.9E574A27@netreach.nospam.net> <347903c2.229709887@zeppelin.home.net>Show Full Headers
Complete Article Headers
Message-ID: <659ogv$qf2$1@node6.frontiernet.net> Subject: Re: nnrpd size with actived Date: Sun, 23 Nov 1997 00:00:00 +0000 From: dsf@node6.frontiernet.net (Dan Foster) References: <347617F5.1877B783@netreach.nospam.net> <656vfo$prc$1@earth.execpc.com> <34773FEA.9E574A27@netreach.nospam.net> <347903c2.229709887@zeppelin.home.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 291855126 X-Complaints-To: abuse@frontiernet.net Organization: Frontier Internet, A reliable part of your life Newsgroups: news.software.nntp