Test at compile time whether siginfo_t is usable for --remote (#119).
This commit is contained in:
@@ -223,6 +223,9 @@
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Signal handlers can determine the sending PID */
|
||||
#undef SIGINFO_PROVIDES_PID
|
||||
|
||||
/* Define to 1 if all of the C90 standard headers exist (not just the ones
|
||||
required in a freestanding environment). This macro is provided for
|
||||
backward compatibility; new code need not use it. */
|
||||
|
||||
@@ -154,13 +154,13 @@ struct pvstate_s {
|
||||
struct sigaction old_sigint;
|
||||
struct sigaction old_sighup;
|
||||
struct sigaction old_sigterm;
|
||||
#ifdef SA_SIGINFO
|
||||
#ifdef SIGINFO_PROVIDES_PID
|
||||
struct sigaction old_sigusr2;
|
||||
#endif
|
||||
struct sigaction old_sigalrm;
|
||||
struct timespec tstp_time; /* see pv_sig_tstp() / __cont() */
|
||||
struct timespec toffset; /* total time spent stopped */
|
||||
#ifdef SA_SIGINFO
|
||||
#ifdef SIGINFO_PROVIDES_PID
|
||||
volatile sig_atomic_t rxusr2; /* whether SIGUSR2 was received */
|
||||
volatile pid_t sender; /* PID of sending process for SIGUSR2 */
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -237,7 +237,7 @@ extern off_t pv_calc_total_size(pvstate_t);
|
||||
*/
|
||||
extern void pv_sig_init(pvstate_t);
|
||||
|
||||
#ifdef SA_SIGINFO
|
||||
#ifdef SIGINFO_PROVIDES_PID
|
||||
/*
|
||||
* Return true if SIGUSR2 has been received, and indicate the sender.
|
||||
*/
|
||||
|
||||
+2
-2
@@ -399,11 +399,11 @@ void display_help(void)
|
||||
{ "-U", "--store-and-forward", N_("FILE"),
|
||||
N_("write all input to FILE before writing to output"),
|
||||
{ 0, 0, 0, 0} },
|
||||
#ifdef SA_SIGINFO
|
||||
#ifdef SIGINFO_PROVIDES_PID
|
||||
{ "-R", "--remote", N_("PID"),
|
||||
N_("update settings of process PID"),
|
||||
{ 0, 0, 0, 0} },
|
||||
#endif /* SA_SIGINFO */
|
||||
#endif /* SIGINFO_PROVIDES_PID */
|
||||
{ "", NULL, NULL, NULL, { 0, 0, 0, 0} },
|
||||
{ "-P", "--pidfile", N_("FILE"),
|
||||
N_("save process ID in FILE"),
|
||||
|
||||
+3
-3
@@ -21,7 +21,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef SA_SIGINFO
|
||||
#ifdef SIGINFO_PROVIDES_PID
|
||||
void pv_error(pvstate_t, char *, ...);
|
||||
|
||||
struct remote_msg {
|
||||
@@ -405,10 +405,10 @@ void pv_remote_fini(void)
|
||||
{
|
||||
}
|
||||
|
||||
#else /* !SA_SIGINFO */
|
||||
#else /* !SIGINFO_PROVIDES_PID */
|
||||
|
||||
/*
|
||||
* Dummy stubs for remote control when we don't have SA_SIGINFO.
|
||||
* Dummy stubs for remote control when we don't have SIGINFO_PROVIDES_PID.
|
||||
*/
|
||||
void pv_remote_init(void)
|
||||
{
|
||||
|
||||
+3
-3
@@ -226,7 +226,7 @@ static void pv_sig_term( /*@unused@ */ __attribute__((unused))
|
||||
}
|
||||
|
||||
|
||||
#ifdef SA_SIGINFO
|
||||
#ifdef SIGINFO_PROVIDES_PID
|
||||
/*
|
||||
* Handle a SIGUSR2 by setting a flag to say we received it, after recording
|
||||
* the sending PID.
|
||||
@@ -375,7 +375,7 @@ void pv_sig_init(pvstate_t state)
|
||||
sa.sa_flags = 0;
|
||||
(void) sigaction(SIGTERM, &sa, &(pv_sig_state->signal.old_sigterm));
|
||||
|
||||
#ifdef SA_SIGINFO
|
||||
#ifdef SIGINFO_PROVIDES_PID
|
||||
/*
|
||||
* Handle SIGUSR2 by setting a flag to say the signal has been
|
||||
* received, and storing the sending process's PID.
|
||||
@@ -431,7 +431,7 @@ void pv_sig_fini( /*@unused@ */ __attribute__((unused)) pvstate_t state)
|
||||
(void) sigaction(SIGINT, &(pv_sig_state->signal.old_sigint), NULL);
|
||||
(void) sigaction(SIGHUP, &(pv_sig_state->signal.old_sighup), NULL);
|
||||
(void) sigaction(SIGTERM, &(pv_sig_state->signal.old_sigterm), NULL);
|
||||
#ifdef SA_SIGINFO
|
||||
#ifdef SIGINFO_PROVIDES_PID
|
||||
(void) sigaction(SIGUSR2, &(pv_sig_state->signal.old_sigusr2), NULL);
|
||||
#endif
|
||||
(void) sigaction(SIGALRM, &(pv_sig_state->signal.old_sigalrm), NULL);
|
||||
|
||||
Reference in New Issue
Block a user