event: add disable_signal_handlers to the spdk_app_opts struct

Currently, there is no way to prevent spdk_app_start() from calling
app_setup_signal_handlers() and setting SPDK's signal handlers.
We'd like to use our own set of signal handlers, therefore this
patch adds a flag to the spdk_app_opts struct that disables this
behaviour.

Signed-off-by: Andreas Economides <andreas.economides@nutanix.com>
Change-Id: I61d7cd66527d819fd5f687d5cc8a03be4fe10a6a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9380
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Andreas Economides 2021-09-02 17:11:33 +00:00 committed by Tomasz Zawadzki
parent 5930558212
commit a89d15e46a
4 changed files with 20 additions and 4 deletions

View File

@ -44,6 +44,10 @@ SoC may be running SPDK on the SoC. That SoC has its own local memory, but SPDK
devices that can also access the host system memory. This library provides infrastructure to enumerate
the memory domains and request hardware perform DMA transfers between them.
### event
Added the `disable_signal_handlers` flag to the `spdk_app_opts` struct.
### log
Added API `spdk_log_to_syslog_level` to return syslog level based on SPDK's

View File

@ -137,6 +137,16 @@ struct spdk_app_opts {
* After that, new added fields should be put after opts_size.
*/
size_t opts_size;
/**
* Disable default signal handlers.
* If set to `true`, the shutdown process is not started implicitly by
* process signals, hence the application is responsible for calling
* spdk_app_start_shutdown().
*
* Default is `false`.
*/
bool disable_signal_handlers;
};
/**

View File

@ -34,8 +34,8 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 9
SO_MINOR := 1
SO_VER := 10
SO_MINOR := 0
CFLAGS += $(ENV_CFLAGS)

View File

@ -224,6 +224,7 @@ spdk_app_opts_init(struct spdk_app_opts *opts, size_t opts_size)
SET_FIELD(rpc_addr, SPDK_DEFAULT_RPC_ADDR);
SET_FIELD(num_entries, SPDK_APP_DEFAULT_NUM_TRACE_ENTRIES);
SET_FIELD(delay_subsystem_init, false);
SET_FIELD(disable_signal_handlers, false);
#undef SET_FIELD
}
@ -460,10 +461,11 @@ app_copy_opts(struct spdk_app_opts *opts, struct spdk_app_opts *opts_user, size_
SET_FIELD(env_context);
SET_FIELD(log);
SET_FIELD(base_virtaddr);
SET_FIELD(disable_signal_handlers);
/* You should not remove this statement, but need to update the assert statement
* if you add a new field, and also add a corresponding SET_FIELD statement */
SPDK_STATIC_ASSERT(sizeof(struct spdk_app_opts) == 184, "Incorrect size");
SPDK_STATIC_ASSERT(sizeof(struct spdk_app_opts) == 192, "Incorrect size");
#undef SET_FIELD
}
@ -569,7 +571,7 @@ spdk_app_start(struct spdk_app_opts *opts_user, spdk_msg_fn start_fn,
return 1;
}
if (app_setup_signal_handlers(opts) != 0) {
if (!opts->disable_signal_handlers && app_setup_signal_handlers(opts) != 0) {
return 1;
}