From: Cristiano Giuffrida Date: Tue, 11 Mar 2014 15:53:14 +0000 (+0100) Subject: service: Extensions for new RS. X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=refs%2Fchanges%2F96%2F3096%2F2;p=minix.git service: Extensions for new RS. Change-Id: Ifb72c7e8c912709edce0fb9ba9efb570901be5fb --- diff --git a/minix/commands/service/service.c b/minix/commands/service/service.c index 854d7911c..0d6c454d4 100644 --- a/minix/commands/service/service.c +++ b/minix/commands/service/service.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -47,9 +48,24 @@ static char *known_requests[] = { "shutdown", "update", "clone", + "unclone", "edit", + "sysctl", "catch for illegal requests" }; +static int known_request_types[] = { + RS_UP, + RS_DOWN, + RS_REFRESH, + RS_RESTART, + RS_SHUTDOWN, + RS_UPDATE, + RS_CLONE, + RS_UNCLONE, + RS_EDIT, + RS_SYSCTL, + 0 +}; #define ILLEGAL_REQUEST sizeof(known_requests)/sizeof(char *) /* Global error number set for failed system calls. */ @@ -68,6 +84,19 @@ static char *known_requests[] = { #define OPT_REUSE "-r" /* reuse executable image */ #define OPT_NOBLOCK "-n" /* unblock caller immediately */ #define OPT_REPLICA "-p" /* create replica for the service */ +#define OPT_BATCH "-b" /* batch mode */ +#define OPT_ASR_LU "-a" /* asr update */ +#define OPT_PREPARE_ONLY_LU "-o" /* prepare-only update */ +#define OPT_FORCE_SELF_LU "-s" /* force self update */ +#define OPT_FORCE_INIT_CRASH "-x" /* force init crash (for debugging) */ +#define OPT_FORCE_INIT_FAIL "-y" /* force init failure (for debugging) */ +#define OPT_FORCE_INIT_TIMEOUT "-z" /* force init timeout (for debugging) */ +#define OPT_FORCE_INIT_DEFCB "-d" /* force init default callback */ +#define OPT_UNSAFE_LU "-u" /* allow unsafe update */ +#define OPT_NOMMAP_LU "-m" /* don't inherit mmaped regions */ +#define OPT_DETACH "-e" /* detach on update/restart */ +#define OPT_NORESTART "-f" /* don't restart */ +#define OPT_FORCE_INIT_ST "-t" /* force init state transfer */ /* Define names for arguments provided to this utility. The first few * arguments are required and have a known index. Thereafter, some optional @@ -79,6 +108,8 @@ static char *known_requests[] = { #define ARG_REQUEST 0 /* request to perform */ #define ARG_PATH 1 /* system service */ #define ARG_LABEL 1 /* name of system service */ +#define ARG_SYSCTL_TYPE 1 /* sysctl action type */ + #define MIN_ARG_COUNT 1 /* require an action */ @@ -98,6 +129,11 @@ static char *known_requests[] = { #define ARG_LU_MAXTIME "-maxtime" /* max time to prepare for the update */ #define ARG_DEVMANID "-devid" /* the id of the devman device this driver should be able to access */ +#define ARG_HEAP_PREALLOC "-heap-prealloc" /* preallocate heap regions */ +#define ARG_MAP_PREALLOC "-map-prealloc" /* preallocate mmapped regions */ +#define ARG_TRG_LABELNAME "-trg-label" /* target label name */ +#define ARG_LU_IPC_BL "-ipc_bl" /* IPC blacklist filter */ +#define ARG_LU_IPC_WL "-ipc_wl" /* IPC whitelist filter */ /* The function parse_arguments() verifies and parses the command line * parameters passed to this utility. Request parameters that are needed @@ -106,6 +142,7 @@ static char *known_requests[] = { static int req_type; static int do_run= 0; /* 'run' command instead of 'up' */ static char *req_label = NULL; +static char *req_trg_label = NULL; static char *req_path = NULL; static char *req_path_self = SELF_REQ_PATH; static char *req_args = ""; @@ -117,6 +154,12 @@ static char *req_config = PATH_CONFIG; static int custom_config_file = 0; static int req_lu_state = DEFAULT_LU_STATE; static int req_lu_maxtime = DEFAULT_LU_MAXTIME; +static long req_heap_prealloc = 0; +static long req_map_prealloc = 0; +static int req_sysctl_type = 0; +static struct rs_ipc_filter_el rs_ipc_filter_els[RS_MAX_IPC_FILTERS][IPCF_MAX_ELEMENTS]; +static int num_ipc_filters = 0; +static char *req_state_eval = NULL; /* Buffer to build "/command arg1 arg2 ..." string to pass to RS server. */ static char command[4096]; @@ -128,15 +171,41 @@ static void print_usage(char *app_name, char *problem) fprintf(stderr, "Warning, %s\n", problem); fprintf(stderr, "Usage:\n"); fprintf(stderr, - " %s [%s %s %s %s] (up|run|edit|update) [%s ] [%s ] [%s ] [%s ] [%s ] [%s ] [%s ] [%s ] [%s ] [%s