Commit a89d15e4 authored by Andreas Economides's avatar Andreas Economides Committed by Tomasz Zawadzki
Browse files

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: default avatarAndreas 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: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarZiye Yang <ziye.yang@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 59305582
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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
+10 −0
Original line number Diff line number Diff line
@@ -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;
};

/**
+2 −2
Original line number Diff line number Diff line
@@ -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)

+4 −2
Original line number Diff line number Diff line
@@ -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;
	}