Prefix pselect functions to clarify debug messages

This commit is contained in:
Darren Tucker 2021-08-20 08:39:33 +10:00
parent 10e45654cf
commit deaadcb93c
1 changed files with 14 additions and 14 deletions

View File

@ -58,7 +58,7 @@ static sighandler_t saved_sighandler[_NSIG];
*/
#define REEXEC_MIN_FREE_FD (STDERR_FILENO + 4)
static int
notify_setup_fd(int *fd)
pselect_notify_setup_fd(int *fd)
{
int r;
@ -76,7 +76,7 @@ notify_setup_fd(int *fd)
static pid_t notify_pid;
static int notify_pipe[2];
static void
notify_setup(void)
pselect_notify_setup(void)
{
static int initialized;
@ -93,8 +93,8 @@ notify_setup(void)
}
if (pipe(notify_pipe) == -1) {
error("pipe(notify_pipe) failed %s", strerror(errno));
} else if (notify_setup_fd(&notify_pipe[0]) == -1 ||
notify_setup_fd(&notify_pipe[1]) == -1) {
} else if (pselect_notify_setup_fd(&notify_pipe[0]) == -1 ||
pselect_notify_setup_fd(&notify_pipe[1]) == -1) {
error("fcntl(notify_pipe, ...) failed %s", strerror(errno));
close(notify_pipe[0]);
close(notify_pipe[1]);
@ -111,19 +111,19 @@ notify_setup(void)
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;
@ -136,11 +136,11 @@ notify_done(fd_set *readset)
/*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;
@ -174,9 +174,9 @@ pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
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),
@ -186,8 +186,8 @@ pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
}
}
if (unmasked) {
notify_setup();
notify_prepare(readfds);
pselect_notify_setup();
pselect_notify_prepare(readfds);
nfds = MAX(nfds, notify_pipe[0]);
}
@ -198,7 +198,7 @@ pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
sigprocmask(SIG_SETMASK, &osig, NULL);
if (unmasked)
notify_done(readfds);
pselect_notify_done(readfds);
errno = saved_errno;
return ret;
}