Thread View: news.software.nntp
1 messages
1 total messages
Started by Dan Foster
Thu, 26 Jun 1997 00:00
Re: actived
Author: Dan Foster
Date: Thu, 26 Jun 1997 00:00
Date: Thu, 26 Jun 1997 00:00
69 lines
2737 bytes
2737 bytes
>From: aos@insync.net
>Date: 25 Jun 1997 21:04:14 GMT
>Message-ID: <5os14e$c87$1@synthemesc.insync.net>
>References: <33A6B41D.3382@iconnet.net> <33A968C6.2C67@raleigh.ibm.com>
><5oc0in$11p$1@earth.execpc.com> <33A98953.6EEA@raleigh.ibm.com>
><5oeh5s$rgk$1@earth.execpc.com> <5opppm$i2p$1@news.wco.com>
><5opspf$2mt$1@synthemesc.insync.net> <5oqdqa$opu$1@news.wco.com>
><5orasp$900$2@synthemesc.insync.net> <33B14F18.7298@ais.net
>
>> fcntl(5, F_SETLK, 0xEFFFF284) Err#11 EAGAIN
>
>You haven't said what file is descriptor 5. fcntl will get an EAGAIN if
>it tries to work on an already-locked file, so it would help if you could
>tell what file is open as number 5. Methinks this might have something to
>do with my replacement of the daemon() call with a fork().
>
> Andrew Smith -- Sysadmin, Insync Internet Services | PGP Fingerprint:
Out of curiosity... why change the daemon() to a fork()?
I couldn't compile it on my SysV box (AIX 4.1.4/4.2.1) so what I did was to
look in the BSD libc sources for daemon(), and it's pretty simple, looks
reasonably portable, and short.
So I copied'n'pasted the sources, and put it in daemon.c, and added daemon.c
and daemon.o to the Makefile. Worked out of the box with no further mods.
Here it is, from FreeBSD 2.2.2-RELEASE libc sources:
#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);
}
-Dan Foster
Internet: dsf@frontiernet.net
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads