unix/fiss

adding config.h into ./configure (b9a5fd5bc5e26183e148285603fc114966ae8e0c)
Repositories | LICENSE

commit b9a5fd5bc5e26183e148285603fc114966ae8e0c
parent bef9ce5eac7f530b56ddb8dcc25774402608f6fc
Author: Friedel Schön <[email protected]>
Date:   Sat, 10 Jun 2023 23:41:40 +0200

adding config.h into ./configure

Diffstat:
MMakefile2+-
Mconfigure90++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Dinclude/config.h133-------------------------------------------------------------------------------
3 files changed, 90 insertions(+), 135 deletions(-)

diff --git a/Makefile b/Makefile @@ -37,7 +37,7 @@ ROFF_FILES := $(patsubst $(MAN_DIR)/%.txt,$(TARGET_MAN_DIR)/%,$(MAN_FILES)) DOCS_FILES := $(patsubst $(DOCS_DIR)/%.txt,$(TARGET_DOCS_DIR)/%.html,$(TEMPL_FILES)) \ $(patsubst $(MAN_DIR)/%.txt,$(TARGET_DOCS_DIR)/%.html,$(MAN_FILES)) -CFLAGS += -I$(INCLUDE_DIR) -DVERSION=\"$(VERSION)\" -g -std=gnu99 +CFLAGS += -I$(INCLUDE_DIR) -I. -DSV_VERSION=\"$(VERSION)\" -g -std=gnu99 LDFLAGS += ifeq ($(VERBOSE),) diff --git a/configure b/configure @@ -24,6 +24,25 @@ MK_MAKE_MAN='tools/make-man.py' MK_VERBOSE= +H_STOP_TIMEOUT=5 # seconds +H_NAME_MAX=128 # chars +H_FAIL_MAX=32 # times +H_SERVICE_MAX=128 # services +H_RUNLEVEL_DEFAULT="default" +H_CHECK_INTERVAL=3 # seconds +H_PARAM_FILE_LINE_MAX=1024 # bytes +H_ENV_FILE_LINE_MAX=1024 # bytes +H_RESCUE_SHELL="/bin/bash" +H_DEPENDENCY_MAX=128 # times +H_ARGUMENTS_MAX=16 # lines +H_ENV_MAX=16 # lines +H_LOG_DIR="/var/log/fiss" +H_USER_BUFFER=256 # chars +H_USER_GROUP_MAX=32 # groups +H_VLOGGER_BUFFER=1024 +H_STATUS_WAIT=5 # seconds + + enable() { if [ -z "$ENABLED" ]; then ENABLED=y @@ -79,6 +98,23 @@ Usage: ./configure [options] --enable-vlogger ........ disables everything but given --enable-* and vlogger --enable-zzz ............ disables everything but given --enable-* and zzz +--stop-timeout .......... sets the timeout whenever service must be killed +--fail-limit ............ sets the limit a service may failed before it is declared as dead +--service-name-limit .... sets the limit of a service name +--service-limit ......... sets the limit of services +--default-runlevel ...... sets the default runlevel started by finit +--check-interval ........ sets the interval services are read and checked +--total-depends-limit ... sets the limit of total dependencies +--log-directory ......... sets the default log directory (default: /var/log/fiss) +--default-fsvc-timeout .. sets the timeout fsvc is wating for status update (default: 5) +--vlogger-buffer ........ sets the buffer vlogger is using (1024 bytes) +--param-line-limit ...... sets the limit of a line in ./param +--param-limit ........... sets the limit of lines in ./params +--env-line-limit ........ sets the limit of a line in ./env +--env-limit ............. sets the limit of lines in ./env +--user-file-limit ....... sets the limit of characters in ./user +--group-limit ........... sets the limit of groups in ./user + --help .................. prints this and exits EOF @@ -130,7 +166,25 @@ while [ -n "$1" ]; do --enable-sigremap) enable sigremap; shift;; --enable-vlogger) enable vlogger; shift;; --enable-zzz) enable zzz; shift;; - + + --stop-timeout) H_STOP_TIMEOUT=$2; shift 2;; + --fail-limit) H_FAIL_MAX=$2; shift 2;; + --service-name-limit) H_NAME_MAX=$2; shift 2;; + --service-limit) H_SERVICE_MAX=$2; shift 2;; + --default-runlevel) H_RUNLEVEL_DEFAULT=$2; shift 2;; + --check-interval) H_CHECK_INTERVAL=$2; shift 2;; + --rescure-shell) H_RESCUE_SHELL=$2; shift 2;; + --total-depends-limit) H_DEPENDENCY_MAX=$2; shift 2;; + --log-directory) H_LOG_DIR=$2; shift 2;; + --default-fsvc-timeout) H_STATUS_WAIT=$2; shift 2;; + --vlogger-buffer) H_VLOGGER_BUFFER=$2; shift 2;; + --param-line-limit) H_PARAM_FILE_LINE_MAX=$2; shift 2;; + --env-line-limit) H_ENV_FILE_LINE_MAX=$2; shift 2;; + --param-limit) H_ARGUMENTS_MAX=$2; shift 2;; + --env-limit) H_ENV_MAX=$2; shift 2;; + --user-file-limit) H_USER_BUFFER=$2; shift 2;; + --group-limit) H_USER_GROUP_MAX=$2; shift 2;; + --help) print_help 0;; *) echo "error: unknown option '$1'"; print_help 1;; esac @@ -143,6 +197,11 @@ command -v $MK_AWK 2>&1 > /dev/null || panic "$MK_AWK is not a valid executable" [ -r $MK_MAKE_DOCS ] || panic "$MK_MAKE_DOCS is not found" [ -r $MK_MAKE_MAN ] || panic "$MK_MAKE_MAN is not found" +H_SERVICE_DIR="$MK_INSTALL_ETC/service.d" +H_START_EXEC="$MK_INSTALL_SHARE/fiss/start" +H_STOP_EXEC="$MK_INSTALL_SHARE/fiss/stop" +H_SUSPEND_EXEC="$MK_INSTALL_SHARE/fiss/suspend" +H_RESUME_EXEC="$MK_INSTALL_SHARE/fiss/resume" cat > config.mk <<EOF BINARIES := $MK_BINARIES @@ -166,4 +225,33 @@ MAKE_MAN := $MK_MAKE_MAN VERBOSE := $MK_VERBOSE EOF +cat > config.h <<EOF +// generated by ./configure + +#pragma once + +#define SV_STOP_TIMEOUT $H_STOP_TIMEOUT +#define SV_NAME_MAX $H_NAME_MAX +#define SV_FAIL_MAX $H_FAIL_MAX +#define SV_SERVICE_MAX $H_SERVICE_MAX +#define SV_CHECK_INTERVAL $H_CHECK_INTERVAL +#define SV_PARAM_FILE_LINE_MAX $H_PARAM_FILE_LINE_MAX +#define SV_ENV_FILE_LINE_MAX $H_ENV_FILE_LINE_MAX +#define SV_DEPENDENCY_MAX $H_DEPENDENCY_MAX +#define SV_ARGUMENTS_MAX $H_ARGUMENTS_MAX +#define SV_ENV_MAX $H_ENV_MAX +#define SV_USER_BUFFER $H_USER_BUFFER +#define SV_USER_GROUP_MAX $H_USER_GROUP_MAX +#define SV_VLOGGER_BUFFER $H_VLOGGER_BUFFER +#define SV_STATUS_WAIT $H_STATUS_WAIT +#define SV_RUNLEVEL_DEFAULT "$H_RUNLEVEL_DEFAULT" +#define SV_LOG_DIR "$H_LOG_DIR" +#define SV_RESCUE_SHELL "$H_RESCUE_SHELL" +#define SV_SERVICE_DIR "$H_SERVICE_DIR" +#define SV_START_EXEC "$H_START_EXEC" +#define SV_STOP_EXEC "$H_STOP_EXEC" +#define SV_SUSPEND_EXEC "$H_SUSPEND_EXEC" +#define SV_RESUME_EXEC "$H_RESUME_EXEC" +EOF + echo 'Configuring succeed!' \ No newline at end of file diff --git a/include/config.h b/include/config.h @@ -1,133 +0,0 @@ -#pragma once - -// the current version, VERSION must be defined by compiler-flag -DVERSION=\"x.x.x\" -#define SV_VERSION VERSION - -// seconds to wait for a service before it gets killed -#ifndef SV_STOP_TIMEOUT -# define SV_STOP_TIMEOUT 5 -#endif - -// maximal characters a service-dir can have -#ifndef SV_NAME_MAX -# define SV_NAME_MAX 128 -#endif - -// maximal dependencies a service can have -#ifndef SV_DEPENDS_MAX -# define SV_DEPENDS_MAX 16 -#endif - -// maximal amount a service may fail -#ifndef SV_FAIL_MAX -# define SV_FAIL_MAX 32 -#endif - -// maximal amount of services that can be registered -#ifndef SV_SERVICE_MAX -# define SV_SERVICE_MAX 128 -#endif - -// default runlevel -#ifndef SV_RUNLEVEL_DEFAULT -# define SV_RUNLEVEL_DEFAULT "default" -#endif - -#ifndef SV_SUPERVISE_EXEC -# define SV_SUPERVISE_EXEC "/sbin/fsvs" -#endif - -// path to service-dir -#ifndef SV_SERVICE_DIR -# define SV_SERVICE_DIR "/etc/service.d" -#endif - -// path to start-script -#ifndef SV_START_EXEC -# define SV_START_EXEC "/usr/share/fiss/start" -#endif - -// path to stop-script -#ifndef SV_STOP_EXEC -# define SV_STOP_EXEC "/usr/share/fiss/stop" -#endif - -// path to suspend-script -#ifndef SV_SUSPEND_EXEC -# define SV_SUSPEND_EXEC "/usr/share/fiss/suspend" -#endif - -// path to resume-script -#ifndef SV_RESUME_EXEC -# define SV_RESUME_EXEC "/usr/share/fiss/resume" -#endif - -// time to wait to accept new connection -#ifndef SV_CHECK_INTERVAL -# define SV_CHECK_INTERVAL 3 // seconds -#endif - -// control socket (%s is the runlevel) -#ifndef SV_CONTROL_SOCKET -# define SV_CONTROL_SOCKET "/run/fiss/control-%s.socket" -#endif - -// maximal size of <service>/params -#ifndef SV_PARAM_FILE_MAX -# define SV_PARAM_FILE_MAX 16384 // 16kb -#endif - -// maximal size of a param in ./params -#ifndef SV_PARAM_FILE_LINE_MAX -# define SV_PARAM_FILE_LINE_MAX 1024 // 16kb -#endif - -// maximal size of a line in ./env -#ifndef SV_ENV_FILE_LINE_MAX -# define SV_ENV_FILE_LINE_MAX 1024 // 16kb -#endif - -// shell to enter if fiss failed -#ifndef SV_RESCUE_SHELL -# define SV_RESCUE_SHELL "/bin/bash" -#endif - -// max dependencies in the dep-tree -#ifndef SV_DEPENDENCY_MAX -# define SV_DEPENDENCY_MAX 512 -#endif - -// max arguments a service can have -#ifndef SV_ARGUMENTS_MAX -# define SV_ARGUMENTS_MAX 16 -#endif - -// maximal count of environment variables in ./env -#ifndef SV_ENV_MAX -# define SV_ENV_MAX 16 -#endif - -// defines the directory where logs are stored -#ifndef SV_LOG_DIR -# define SV_LOG_DIR "/var/log/fiss" -#endif - -#ifndef SV_SOCKET_SERVICE_MAX -# define SV_SOCKET_SERVICE_MAX 128 -#endif - -#ifndef SV_USER_BUFFER -# define SV_USER_BUFFER 256 -#endif - -#ifndef SV_USER_GROUP_MAX -# define SV_USER_GROUP_MAX 32 -#endif - -#ifndef SV_VLOGGER_BUFFER -# define SV_VLOGGER_BUFFER 1024 -#endif - -#ifndef SV_STATUS_WAIT -# define SV_STATUS_WAIT 5 -#endif