mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
cleanup: libast: remove pre-fork(2) code (re: 7b0e0776
)
I had removed the legacy code for systems without fork(2) from ksh93, but not from libast. This commit deos that.
This commit is contained in:
parent
7a06d911e0
commit
7af1d56e7f
7 changed files with 71 additions and 141 deletions
|
@ -65,18 +65,11 @@ CHAR_MAX C XX 1 L
|
|||
CHAR_MIN C XX 1 L
|
||||
CHAR_TERM POSIX SC 2 FUW
|
||||
CHILD_MAX POSIX SC 1 CDLMUX 6 cc{
|
||||
#if _lib_fork
|
||||
#define child() fork()
|
||||
#else
|
||||
extern int spawnve(const char*, char* const[], char* const[]);
|
||||
static char* cmd[] = { "/bin/echo", 0 };
|
||||
#define child() spawnve(cmd[0],cmd,(char**)0)
|
||||
#endif
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
int n;
|
||||
for (i = 3; i < 512 && (n = child()) >= 0; i++)
|
||||
for (i = 3; i < 512 && (n = fork()) >= 0; i++)
|
||||
if (!n) _exit(0);
|
||||
while (wait((int*)0) > 0);
|
||||
for (n = 8; n < i; n <<= 1);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1985-2012 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -65,24 +65,6 @@ setsid(void)
|
|||
ioctl(fd, TIOCNOTTY, 0);
|
||||
close(fd);
|
||||
}
|
||||
#else
|
||||
|
||||
/*
|
||||
* second child in s5 to avoid reacquiring the control tty
|
||||
*/
|
||||
|
||||
#if _lib_fork && HUH920711 /* some s5's botch this */
|
||||
switch (fork())
|
||||
{
|
||||
case -1:
|
||||
exit(1);
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
return(pg);
|
||||
}
|
||||
|
|
|
@ -174,7 +174,6 @@ spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid, i
|
|||
pid_t
|
||||
spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid, int tcfd)
|
||||
{
|
||||
#if _lib_fork || _lib_vfork
|
||||
int n;
|
||||
int m;
|
||||
pid_t pid;
|
||||
|
@ -184,19 +183,15 @@ spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid, i
|
|||
volatile int* volatile exec_errno_ptr;
|
||||
#else
|
||||
int err[2];
|
||||
#endif
|
||||
#endif
|
||||
#endif /* _real_vfork */
|
||||
|
||||
NOT_USED(tcfd);
|
||||
if (!envv)
|
||||
envv = environ;
|
||||
#if _lib_spawnve
|
||||
#if _lib_fork || _lib_vfork
|
||||
if (!pgid)
|
||||
#endif
|
||||
return spawnve(path, argv, envv);
|
||||
#endif
|
||||
#if _lib_fork || _lib_vfork
|
||||
#endif /* _lib_spawnve */
|
||||
n = errno;
|
||||
#if _real_vfork
|
||||
exec_errno = 0;
|
||||
|
@ -209,13 +204,13 @@ spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid, i
|
|||
fcntl(err[0], F_SETFD, FD_CLOEXEC);
|
||||
fcntl(err[1], F_SETFD, FD_CLOEXEC);
|
||||
}
|
||||
#endif
|
||||
#endif /* _real_vfork */
|
||||
sigcritical(SIG_REG_EXEC|SIG_REG_PROC);
|
||||
#if _lib_vfork
|
||||
pid = vfork();
|
||||
#else
|
||||
pid = fork();
|
||||
#endif
|
||||
#endif /* _lib_vfork */
|
||||
if (pid == -1)
|
||||
n = errno;
|
||||
else if (!pid)
|
||||
|
@ -236,7 +231,7 @@ spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid, i
|
|||
#elif defined(TIOCSPGRP)
|
||||
if (m)
|
||||
ioctl(2, TIOCSPGRP, &pgid);
|
||||
#endif
|
||||
#endif /* _lib_tcgetpgrp */
|
||||
}
|
||||
execve(path, argv, envv);
|
||||
#if _real_vfork
|
||||
|
@ -247,7 +242,7 @@ spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid, i
|
|||
m = errno;
|
||||
write(err[1], &m, sizeof(m));
|
||||
}
|
||||
#endif
|
||||
#endif /* _real_vfork */
|
||||
_exit(errno == ENOENT ? EXIT_NOTFOUND : EXIT_NOEXEC);
|
||||
}
|
||||
rid = pid;
|
||||
|
@ -280,7 +275,7 @@ spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid, i
|
|||
}
|
||||
close(err[0]);
|
||||
}
|
||||
#endif
|
||||
#endif /* _real_vfork */
|
||||
sigcritical(0);
|
||||
if (pid != -1 && pgid > 0)
|
||||
{
|
||||
|
@ -295,10 +290,6 @@ spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid, i
|
|||
}
|
||||
errno = n;
|
||||
return rid;
|
||||
#else
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1985-2011 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
@ -40,12 +40,7 @@ NoN(vfork)
|
|||
extern pid_t
|
||||
vfork(void)
|
||||
{
|
||||
#if _lib_fork
|
||||
return(fork());
|
||||
#else
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -64,6 +64,9 @@ struct _sfio_s;
|
|||
#endif
|
||||
|
||||
#include <ast_lib.h>
|
||||
#if !_lib_fork
|
||||
#error In 2022, libast joined the 21st century and started requiring fork(2).
|
||||
#endif
|
||||
#include <ast_sys.h>
|
||||
#include <ast_getopt.h> /* <stdlib.h> does this */
|
||||
#include <ast_fcntl.h>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
..
|
||||
.TH PROC 3
|
||||
.SH NAME
|
||||
proc \- process control routines
|
||||
proc \- process control routines (deprecated)
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <proc.h>
|
||||
|
@ -50,14 +50,15 @@ int procrun(const char* \fIcommand\fP, char** \fIargv\fP);
|
|||
.EE
|
||||
.SH DESCRIPTION
|
||||
These routines provide a portable interface to process creation and execution.
|
||||
They work on systems with
|
||||
.IR fork (2)
|
||||
and
|
||||
.IR exec (2)
|
||||
as well as on systems with only
|
||||
They used to work on systems with only
|
||||
.IR spawnve (2)
|
||||
or
|
||||
.IR spawnveg (3).
|
||||
Now that libast has joined the 21st century and requires
|
||||
.IR fork (2)
|
||||
and
|
||||
.IR execve (2),
|
||||
this interface is deprecated and only kept for backward compatibility.
|
||||
.PP
|
||||
.L procopen
|
||||
runs
|
||||
|
|
|
@ -40,19 +40,11 @@
|
|||
* not quite ready for _use_spawnveg
|
||||
*/
|
||||
|
||||
#if _use_spawnveg
|
||||
#if _lib_fork
|
||||
#undef _use_spawnveg
|
||||
#else
|
||||
#if _WINIX
|
||||
#define _lib_fork 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_PROC
|
||||
#define DEBUG_PROC 1
|
||||
#endif
|
||||
#endif /* DEBUG_PROC */
|
||||
|
||||
#if _lib_socketpair
|
||||
#if _sys_socket
|
||||
|
@ -60,8 +52,8 @@
|
|||
#include <sys/socket.h>
|
||||
#else
|
||||
#undef _lib_socketpair
|
||||
#endif
|
||||
#endif
|
||||
#endif /* _sys_socket */
|
||||
#endif /* _lib_socketpair */
|
||||
|
||||
Proc_t proc_default = { -1 };
|
||||
|
||||
|
@ -104,7 +96,7 @@ setopt(register void* a, register const void* p, register int n, const char* v)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* DEBUG_PROC */
|
||||
|
||||
#if _use_spawnveg
|
||||
|
||||
|
@ -135,7 +127,7 @@ typedef struct Mod_s
|
|||
|
||||
} Modify_t;
|
||||
|
||||
#endif
|
||||
#endif /* _use_spawnveg */
|
||||
|
||||
#ifdef SIGPIPE
|
||||
|
||||
|
@ -150,7 +142,7 @@ ignoresig(int sig)
|
|||
signal(sig, ignoresig);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* SIGPIPE */
|
||||
|
||||
/*
|
||||
* do modification op and save previous state for restore()
|
||||
|
@ -159,13 +151,12 @@ ignoresig(int sig)
|
|||
static int
|
||||
modify(Proc_t* proc, int forked, int op, long arg1, long arg2)
|
||||
{
|
||||
#if _lib_fork
|
||||
if (forked)
|
||||
{
|
||||
int i;
|
||||
#ifndef TIOCSCTTY
|
||||
char* s;
|
||||
#endif
|
||||
#endif /* !TIOCSCTTY */
|
||||
|
||||
switch (op)
|
||||
{
|
||||
|
@ -199,7 +190,7 @@ modify(Proc_t* proc, int forked, int op, long arg1, long arg2)
|
|||
return -1;
|
||||
if ((arg2 = open(s, O_RDWR)) < 0)
|
||||
return -1;
|
||||
#endif
|
||||
#endif /* TIOCSCTTY */
|
||||
for (i = 0; i <= 2; i++)
|
||||
if (arg1 != i && arg2 != i && fcntl(arg1, F_DUPFD, i) != i)
|
||||
return -1;
|
||||
|
@ -234,11 +225,6 @@ modify(Proc_t* proc, int forked, int op, long arg1, long arg2)
|
|||
}
|
||||
#if _use_spawnveg
|
||||
else
|
||||
#endif
|
||||
#else
|
||||
NoP(forked);
|
||||
#endif
|
||||
#if _use_spawnveg
|
||||
{
|
||||
register Modify_t* m;
|
||||
|
||||
|
@ -266,7 +252,7 @@ modify(Proc_t* proc, int forked, int op, long arg1, long arg2)
|
|||
}
|
||||
#if F_dupfd_cloexec == F_DUPFD
|
||||
fcntl(m->save, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
#endif /* F_dupfd_cloexec == F_DUPFD */
|
||||
close(arg2);
|
||||
if (fcntl(arg1, F_DUPFD, arg2) != arg2)
|
||||
return -1;
|
||||
|
@ -313,7 +299,7 @@ modify(Proc_t* proc, int forked, int op, long arg1, long arg2)
|
|||
}
|
||||
#else
|
||||
NoP(proc);
|
||||
#endif
|
||||
#endif /* _use_spawnveg */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -383,7 +369,7 @@ restore(Proc_t* proc)
|
|||
|
||||
#define restore(p)
|
||||
|
||||
#endif
|
||||
#endif /* _use_spawnveg */
|
||||
|
||||
/*
|
||||
* fork and exec or spawn proc(argv) and return a Proc_t handle
|
||||
|
@ -410,38 +396,30 @@ procopen(const char* cmd, char** argv, char** envv, long* modv, int flags)
|
|||
char path[PATH_MAX];
|
||||
char env[PATH_MAX + 2];
|
||||
int pio[2];
|
||||
#if _lib_fork
|
||||
int pop[2];
|
||||
#endif
|
||||
#if !_pipe_rw && !_lib_socketpair
|
||||
int poi[2];
|
||||
#endif
|
||||
#endif /* !_pipe_rw && !_lib_socketpair */
|
||||
#if defined(SIGCHLD) && ( _lib_sigprocmask || _lib_sigsetmask )
|
||||
Sig_mask_t mask;
|
||||
#endif
|
||||
#endif /* defined(SIGCHLD) && ( _lib_sigprocmask || _lib_sigsetmask ) */
|
||||
#if _use_spawnveg
|
||||
int newenv = 0;
|
||||
#endif
|
||||
#endif /* _use_spawnveg */
|
||||
#if DEBUG_PROC
|
||||
int debug = PROC_OPT_EXEC;
|
||||
#endif
|
||||
#endif /* DEBUG_PROC */
|
||||
|
||||
#if _lib_fork
|
||||
if (!argv && (flags & (PROC_ORPHAN|PROC_OVERLAY)))
|
||||
#else
|
||||
if (!argv || (flags & PROC_ORPHAN))
|
||||
#endif
|
||||
{
|
||||
errno = ENOEXEC;
|
||||
return 0;
|
||||
}
|
||||
pio[0] = pio[1] = -1;
|
||||
#if _lib_fork
|
||||
pop[0] = pop[1] = -1;
|
||||
#endif
|
||||
#if !_pipe_rw && !_lib_socketpair
|
||||
poi[0] = poi[1] = -1;
|
||||
#endif
|
||||
#endif /* !_pipe_rw && !_lib_socketpair */
|
||||
if (cmd && (!*cmd || !pathpath(cmd, NiL, PATH_REGULAR|PATH_EXECUTE, path, sizeof(path))))
|
||||
goto bad;
|
||||
switch (flags & (PROC_READ|PROC_WRITE))
|
||||
|
@ -476,7 +454,7 @@ procopen(const char* cmd, char** argv, char** envv, long* modv, int flags)
|
|||
#if _use_spawnveg
|
||||
if (!(flags & PROC_ORPHAN))
|
||||
newenv = 1;
|
||||
#endif
|
||||
#endif /* _use_spawnveg */
|
||||
}
|
||||
if (procfd >= 0)
|
||||
{
|
||||
|
@ -492,11 +470,11 @@ procopen(const char* cmd, char** argv, char** envv, long* modv, int flags)
|
|||
#else
|
||||
if (pipe(pio) || pipe(poi))
|
||||
goto bad;
|
||||
#endif
|
||||
#endif /* _lib_socketpair */
|
||||
}
|
||||
else if (pipe(pio))
|
||||
goto bad;
|
||||
#endif
|
||||
#endif /* _pipe_rw */
|
||||
}
|
||||
if (flags & PROC_OVERLAY)
|
||||
{
|
||||
|
@ -506,8 +484,7 @@ procopen(const char* cmd, char** argv, char** envv, long* modv, int flags)
|
|||
#if _use_spawnveg
|
||||
else if (argv && !(flags & PROC_ORPHAN))
|
||||
proc->pid = 0;
|
||||
#endif
|
||||
#if _lib_fork
|
||||
#endif /* _use_spawnveg */
|
||||
else
|
||||
{
|
||||
if (!(flags & PROC_FOREGROUND))
|
||||
|
@ -528,9 +505,9 @@ procopen(const char* cmd, char** argv, char** envv, long* modv, int flags)
|
|||
proc->mask = sigblock(mask);
|
||||
#else
|
||||
proc->sigchld = signal(SIGCHLD, SIG_DFL);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif /* _lib_sigsetmask */
|
||||
#endif /* _lib_sigprocmask */
|
||||
#endif /* defined(SIGCHLD) */
|
||||
}
|
||||
if ((flags & PROC_ORPHAN) && pipe(pop))
|
||||
goto bad;
|
||||
|
@ -558,15 +535,14 @@ procopen(const char* cmd, char** argv, char** envv, long* modv, int flags)
|
|||
#else
|
||||
if (proc->sigchld != SIG_IGN)
|
||||
signal(SIGCHLD, SIG_DFL);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif /* _lib_sigsetmask */
|
||||
#endif /* _lib_sigprocmask */
|
||||
#endif /* defined(SIGCHLD) */
|
||||
}
|
||||
else if (proc->pid == -1)
|
||||
goto bad;
|
||||
forked = 1;
|
||||
}
|
||||
#endif
|
||||
if (!proc->pid)
|
||||
{
|
||||
#if _use_spawnveg
|
||||
|
@ -574,8 +550,7 @@ procopen(const char* cmd, char** argv, char** envv, long* modv, int flags)
|
|||
char* oenviron0 = 0;
|
||||
|
||||
v = 0;
|
||||
#endif
|
||||
#if _lib_fork
|
||||
#endif /* _use_spawnveg */
|
||||
if (flags & PROC_ORPHAN)
|
||||
{
|
||||
if (!(proc->pid = fork()))
|
||||
|
@ -590,10 +565,8 @@ procopen(const char* cmd, char** argv, char** envv, long* modv, int flags)
|
|||
_exit(EXIT_NOEXEC);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if DEBUG_PROC
|
||||
stropt(getenv(PROC_ENV_OPTIONS), options, sizeof(*options), setopt, &debug);
|
||||
#if _lib_fork
|
||||
if (debug & PROC_OPT_TRACE)
|
||||
{
|
||||
if (!fork())
|
||||
|
@ -604,30 +577,29 @@ procopen(const char* cmd, char** argv, char** envv, long* modv, int flags)
|
|||
}
|
||||
sleep(2);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif /* DEBUG_PROC */
|
||||
if (flags & PROC_DAEMON)
|
||||
{
|
||||
#ifdef SIGHUP
|
||||
modify(proc, forked, PROC_sig_ign, SIGHUP, 0);
|
||||
#endif
|
||||
#endif /* SIGHUP */
|
||||
modify(proc, forked, PROC_sig_dfl, SIGTERM, 0);
|
||||
#ifdef SIGTSTP
|
||||
modify(proc, forked, PROC_sig_ign, SIGTSTP, 0);
|
||||
#endif
|
||||
#endif /* SIGTSTP */
|
||||
#ifdef SIGTTIN
|
||||
modify(proc, forked, PROC_sig_ign, SIGTTIN, 0);
|
||||
#endif
|
||||
#endif /* SIGTTIN */
|
||||
#ifdef SIGTTOU
|
||||
modify(proc, forked, PROC_sig_ign, SIGTTOU, 0);
|
||||
#endif
|
||||
#endif /* SIGTTOU */
|
||||
}
|
||||
if (flags & (PROC_BACKGROUND|PROC_DAEMON))
|
||||
{
|
||||
modify(proc, forked, PROC_sig_ign, SIGINT, 0);
|
||||
#ifdef SIGQUIT
|
||||
modify(proc, forked, PROC_sig_ign, SIGQUIT, 0);
|
||||
#endif
|
||||
#endif /* SIGQUIT */
|
||||
}
|
||||
if (flags & (PROC_DAEMON|PROC_SESSION))
|
||||
modify(proc, forked, PROC_sys_pgrp, -1, 0);
|
||||
|
@ -657,7 +629,7 @@ procopen(const char* cmd, char** argv, char** envv, long* modv, int flags)
|
|||
goto cleanup;
|
||||
if (poi[1] != 0 && modify(proc, forked, PROC_fd_dup|PROC_FD_CHILD, poi[1], PROC_ARG_NULL))
|
||||
goto cleanup;
|
||||
#endif
|
||||
#endif /* _pipe_rw || _lib_socketpair */
|
||||
}
|
||||
else if (procfd >= 0)
|
||||
{
|
||||
|
@ -682,28 +654,23 @@ procopen(const char* cmd, char** argv, char** envv, long* modv, int flags)
|
|||
goto cleanup;
|
||||
break;
|
||||
}
|
||||
#if _lib_fork
|
||||
if (forked && (flags & PROC_ENVCLEAR))
|
||||
environ = 0;
|
||||
#if _use_spawnveg
|
||||
else
|
||||
#endif
|
||||
#endif
|
||||
#if _use_spawnveg
|
||||
if (newenv)
|
||||
else if (newenv)
|
||||
{
|
||||
p = environ;
|
||||
while (*p++);
|
||||
if (!(oenviron = (char**)memdup(environ, (p - environ) * sizeof(char*))))
|
||||
goto cleanup;
|
||||
}
|
||||
#endif
|
||||
#endif /* _use_spawnveg */
|
||||
if (argv && envv != (char**)environ)
|
||||
{
|
||||
#if _use_spawnveg
|
||||
if (!newenv && environ[0][0] == '_' && environ[0][1] == '=')
|
||||
oenviron0 = environ[0];
|
||||
#endif
|
||||
#endif /* _use_spawnveg */
|
||||
env[0] = '_';
|
||||
env[1] = '=';
|
||||
env[2] = 0;
|
||||
|
@ -717,10 +684,8 @@ procopen(const char* cmd, char** argv, char** envv, long* modv, int flags)
|
|||
if (!setenviron(*p++))
|
||||
goto cleanup;
|
||||
p = argv;
|
||||
#if _lib_fork
|
||||
if (forked && !p)
|
||||
return proc;
|
||||
#endif
|
||||
#if DEBUG_PROC
|
||||
if (!(debug & PROC_OPT_EXEC) || (debug & PROC_OPT_VERBOSE))
|
||||
{
|
||||
|
@ -737,7 +702,7 @@ sfsync(sfstderr);
|
|||
_exit(0);
|
||||
p = argv;
|
||||
}
|
||||
#endif
|
||||
#endif /* DEBUG_PROC */
|
||||
if (cmd)
|
||||
{
|
||||
strcpy(env + 2, path);
|
||||
|
@ -746,7 +711,7 @@ sfsync(sfstderr);
|
|||
#if _use_spawnveg
|
||||
else if ((proc->pid = spawnveg(path, p, environ, proc->pgrp, -1)) != -1)
|
||||
goto cleanup;
|
||||
#endif
|
||||
#endif /* _use_spawnveg */
|
||||
if (errno != ENOEXEC)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -774,7 +739,7 @@ sfsync(sfstderr);
|
|||
#if _use_spawnveg
|
||||
else
|
||||
proc->pid = spawnveg(env + 2, p, environ, proc->pgrp, -1);
|
||||
#endif
|
||||
#endif /* _use_spawnveg */
|
||||
cleanup:
|
||||
if (forked)
|
||||
{
|
||||
|
@ -798,7 +763,7 @@ sfsync(sfstderr);
|
|||
restore(proc);
|
||||
if (flags & PROC_OVERLAY)
|
||||
exit(0);
|
||||
#endif
|
||||
#endif /* _use_spawnveg */
|
||||
}
|
||||
if (proc->pid != -1)
|
||||
{
|
||||
|
@ -820,9 +785,9 @@ sfsync(sfstderr);
|
|||
proc->mask = sigblock(mask);
|
||||
#else
|
||||
proc->sigchld = signal(SIGCHLD, SIG_DFL);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif /* _lib_sigsetmask */
|
||||
#endif /* _lib_sigprocmask */
|
||||
#endif /* defined(SIGCHLD) */
|
||||
}
|
||||
}
|
||||
else if (modv)
|
||||
|
@ -855,7 +820,7 @@ sfsync(sfstderr);
|
|||
if ((handler = signal(SIGPIPE, ignoresig)) != SIG_DFL && handler != ignoresig)
|
||||
signal(SIGPIPE, handler);
|
||||
}
|
||||
#endif
|
||||
#endif /* SIGPIPE */
|
||||
switch (procfd)
|
||||
{
|
||||
case 0:
|
||||
|
@ -868,7 +833,7 @@ sfsync(sfstderr);
|
|||
#else
|
||||
proc->wfd = poi[1];
|
||||
close(poi[0]);
|
||||
#endif
|
||||
#endif /* _pipe_rw || _lib_socketpair */
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
proc->rfd = pio[0];
|
||||
|
@ -907,9 +872,9 @@ sfsync(sfstderr);
|
|||
#else
|
||||
if (proc->sigchld != SIG_DFL)
|
||||
signal(SIGCHLD, proc->sigchld);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif /* _lib_sigsetmask */
|
||||
#endif /* _lib_sigprocmask */
|
||||
#endif /* defined(SIGCHLD) */
|
||||
}
|
||||
if ((flags & PROC_CLEANUP) && modv)
|
||||
for (i = 0; n = modv[i]; i++)
|
||||
|
@ -936,7 +901,7 @@ sfsync(sfstderr);
|
|||
close(poi[0]);
|
||||
if (poi[1] >= 0)
|
||||
close(poi[1]);
|
||||
#endif
|
||||
#endif /* !_pipe_rw && !_lib_socketpair */
|
||||
procfree(proc);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue