version 1.13, 1997/08/31 14:32:14 |
version 1.14, 1997/11/14 00:23:54 |
|
|
struct fp *fpp; |
struct fp *fpp; |
|
|
if ((fpp = (struct fp *)malloc(sizeof(*fpp))) == NULL) |
if ((fpp = (struct fp *)malloc(sizeof(*fpp))) == NULL) |
panic("Out of memory"); |
errx(1, "Out of memory"); |
fpp->fp = fp; |
fpp->fp = fp; |
fpp->pipe = pipe; |
fpp->pipe = pipe; |
fpp->pid = pid; |
fpp->pid = pid; |
|
|
(void)free(p); |
(void)free(p); |
return; |
return; |
} |
} |
panic("Invalid file pointer"); |
errx(1, "Invalid file pointer"); |
} |
} |
|
|
static int |
static int |
|
|
for (p = fp_head; p; p = p->link) |
for (p = fp_head; p; p = p->link) |
if (p->fp == fp) |
if (p->fp == fp) |
return(p->pid); |
return(p->pid); |
panic("Invalid file pointer"); |
errx(1, "Invalid file pointer"); |
/*NOTREACHED*/ |
/*NOTREACHED*/ |
} |
} |
|
|
|
|
findchild(pid) |
findchild(pid) |
int pid; |
int pid; |
{ |
{ |
register struct child **cpp; |
struct child **cpp; |
|
|
for (cpp = &child; *cpp != NULL && (*cpp)->pid != pid; |
for (cpp = &child; *cpp != NULL && (*cpp)->pid != pid; |
cpp = &(*cpp)->link) |
cpp = &(*cpp)->link) |
|
|
|
|
static void |
static void |
delchild(cp) |
delchild(cp) |
register struct child *cp; |
struct child *cp; |
{ |
{ |
register struct child **cpp; |
struct child **cpp; |
|
|
for (cpp = &child; *cpp != cp; cpp = &(*cpp)->link) |
for (cpp = &child; *cpp != cp; cpp = &(*cpp)->link) |
; |
; |
|
|
{ |
{ |
int pid; |
int pid; |
int status; |
int status; |
register struct child *cp; |
struct child *cp; |
int save_errno = errno; |
int save_errno = errno; |
|
|
while ((pid = |
while ((pid = |
|
|
wait_child(pid) |
wait_child(pid) |
int pid; |
int pid; |
{ |
{ |
register struct child *cp = findchild(pid); |
struct child *cp = findchild(pid); |
sigset_t nset, oset; |
sigset_t nset, oset; |
|
|
sigemptyset(&nset); |
sigemptyset(&nset); |
|
|
free_child(pid) |
free_child(pid) |
int pid; |
int pid; |
{ |
{ |
register struct child *cp = findchild(pid); |
struct child *cp = findchild(pid); |
sigset_t nset, oset; |
sigset_t nset, oset; |
|
|
sigemptyset(&nset); |
sigemptyset(&nset); |
|
|
} else if (action == 1) { |
} else if (action == 1) { |
/* Create the lock */ |
/* Create the lock */ |
if ((cmd = (char *)malloc(sizeof(_PATH_MAIL_LOCAL) + 3)) == NULL) |
if ((cmd = (char *)malloc(sizeof(_PATH_MAIL_LOCAL) + 3)) == NULL) |
panic("Out of memory"); |
errx(1, "Out of memory"); |
sprintf(cmd, "%s -H", _PATH_MAIL_LOCAL); |
sprintf(cmd, "%s -H", _PATH_MAIL_LOCAL); |
if ((lockfp = Popen(cmd, "r")) == NULL || getc(lockfp) != '1') { |
if ((lockfp = Popen(cmd, "r")) == NULL || getc(lockfp) != '1') { |
lockfp = NULL; |
lockfp = NULL; |