*/
#define REEXEC_MIN_FREE_FD (STDERR_FILENO + 4)
static int
-notify_setup_fd(int *fd)
+pselect_notify_setup_fd(int *fd)
{
int r;
static pid_t notify_pid;
static int notify_pipe[2];
static void
-notify_setup(void)
+pselect_notify_setup(void)
{
static int initialized;
}
if (pipe(notify_pipe) == -1) {
error("pipe(notify_pipe) failed %s", strerror(errno));
- } else if (notify_setup_fd(¬ify_pipe[0]) == -1 ||
- notify_setup_fd(¬ify_pipe[1]) == -1) {
+ } else if (pselect_notify_setup_fd(¬ify_pipe[0]) == -1 ||
+ pselect_notify_setup_fd(¬ify_pipe[1]) == -1) {
error("fcntl(notify_pipe, ...) failed %s", strerror(errno));
close(notify_pipe[0]);
close(notify_pipe[1]);
notify_pipe[1] = -1; /* write end */
}
static void
-notify_parent(void)
+pselect_notify_parent(void)
{
if (notify_pipe[1] != -1)
(void)write(notify_pipe[1], "", 1);
}
static void
-notify_prepare(fd_set *readset)
+pselect_notify_prepare(fd_set *readset)
{
if (notify_pipe[0] != -1)
FD_SET(notify_pipe[0], readset);
}
static void
-notify_done(fd_set *readset)
+pselect_notify_done(fd_set *readset)
{
char c;
/*ARGSUSED*/
static void
-sig_handler(int sig)
+pselect_sig_handler(int sig)
{
int save_errno = errno;
- notify_parent();
+ pselect_notify_parent();
if (saved_sighandler[sig] != NULL)
(*saved_sighandler[sig])(sig); /* call original handler */
errno = save_errno;
if (sigaction(sig, NULL, &sa) == 0 &&
sa.sa_handler != SIG_IGN && sa.sa_handler != SIG_DFL) {
unmasked = 1;
- if (sa.sa_handler == sig_handler)
+ if (sa.sa_handler == pselect_sig_handler)
continue;
- sa.sa_handler = sig_handler;
+ sa.sa_handler = pselect_sig_handler;
if (sigaction(sig, &sa, &osa) == 0) {
debug3_f("installing signal handler for %s, "
"previous %p", strsignal(sig),
}
}
if (unmasked) {
- notify_setup();
- notify_prepare(readfds);
+ pselect_notify_setup();
+ pselect_notify_prepare(readfds);
nfds = MAX(nfds, notify_pipe[0]);
}
sigprocmask(SIG_SETMASK, &osig, NULL);
if (unmasked)
- notify_done(readfds);
+ pselect_notify_done(readfds);
errno = saved_errno;
return ret;
}