event: Use SIG_UNBLOCK instead of SIG_NEW for signals
Install signals by enabling new ones, not by disabling all of them. This preserves default behavior. Change-Id: I8d0e4753a5f321fc3756b41cd2312124fabeed29 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/372169 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
4bd306630b
commit
62d3b6897a
@ -195,7 +195,7 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_event_fn start_fn,
|
|||||||
struct spdk_conf *config;
|
struct spdk_conf *config;
|
||||||
struct spdk_conf_section *sp;
|
struct spdk_conf_section *sp;
|
||||||
struct sigaction sigact;
|
struct sigaction sigact;
|
||||||
sigset_t signew;
|
sigset_t sigmask;
|
||||||
char shm_name[64];
|
char shm_name[64];
|
||||||
int rc;
|
int rc;
|
||||||
uint64_t tpoint_group_mask;
|
uint64_t tpoint_group_mask;
|
||||||
@ -290,8 +290,7 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_event_fn start_fn,
|
|||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setup signal handler thread */
|
sigemptyset(&sigmask);
|
||||||
pthread_sigmask(SIG_SETMASK, NULL, &signew);
|
|
||||||
|
|
||||||
memset(&sigact, 0, sizeof(sigact));
|
memset(&sigact, 0, sizeof(sigact));
|
||||||
sigact.sa_handler = SIG_IGN;
|
sigact.sa_handler = SIG_IGN;
|
||||||
@ -311,7 +310,7 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_event_fn start_fn,
|
|||||||
spdk_conf_free(g_spdk_app.config);
|
spdk_conf_free(g_spdk_app.config);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
sigaddset(&signew, SIGINT);
|
sigaddset(&sigmask, SIGINT);
|
||||||
|
|
||||||
sigact.sa_handler = __shutdown_signal;
|
sigact.sa_handler = __shutdown_signal;
|
||||||
sigemptyset(&sigact.sa_mask);
|
sigemptyset(&sigact.sa_mask);
|
||||||
@ -321,7 +320,7 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_event_fn start_fn,
|
|||||||
spdk_conf_free(g_spdk_app.config);
|
spdk_conf_free(g_spdk_app.config);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
sigaddset(&signew, SIGTERM);
|
sigaddset(&sigmask, SIGTERM);
|
||||||
|
|
||||||
if (opts->usr1_handler != NULL) {
|
if (opts->usr1_handler != NULL) {
|
||||||
sigact.sa_handler = opts->usr1_handler;
|
sigact.sa_handler = opts->usr1_handler;
|
||||||
@ -332,12 +331,10 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_event_fn start_fn,
|
|||||||
spdk_conf_free(g_spdk_app.config);
|
spdk_conf_free(g_spdk_app.config);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
sigaddset(&signew, SIGUSR1);
|
sigaddset(&sigmask, SIGUSR1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sigaddset(&signew, SIGQUIT);
|
pthread_sigmask(SIG_UNBLOCK, &sigmask, NULL);
|
||||||
sigaddset(&signew, SIGHUP);
|
|
||||||
pthread_sigmask(SIG_SETMASK, &signew, NULL);
|
|
||||||
|
|
||||||
if (opts->shm_id >= 0) {
|
if (opts->shm_id >= 0) {
|
||||||
snprintf(shm_name, sizeof(shm_name), "/%s_trace.%d", opts->name, opts->shm_id);
|
snprintf(shm_name, sizeof(shm_name), "/%s_trace.%d", opts->name, opts->shm_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user