aboutsummaryrefslogtreecommitdiff
path: root/src/piesctl.c
AgeCommit message (Collapse)AuthorFiles
2019-05-24Don't remove finished startup components. Just mark them with status_finished.Sergey Poznyakoff1
* src/ctl.c (pies_comp_mode_str): Add pies_comp_startup and pies_comp_shutdown. * src/piesctl.c (mode_trans): Likewise. * src/progman.c (progman_startup_phase): Test the status of pies_comp_startup components. (progman_waiting_p): Test status instead of pid>0 to select running components. (progman_cleanup): Set status of the finished startup component to status_finished, instead of removing it. * src/comp.c (loaded): Remove unused variable. (component_config_commit): Remove special handling for pies_comp_startup.
2019-05-23Update copyright yearsSergey Poznyakoff1
2019-05-20Upgrade grecsSergey Poznyakoff1
2017-01-02Happy GNU YearSergey Poznyakoff1
2016-07-16Don't concatenate adjacent strings in configuration files.Sergey Poznyakoff1
* grecs: Upgrade. * src/pies.h: Fix include paths. * src/piesctl.c: Likewise. * NEWS: Document changes. * doc/pies.texi: Likewise.
2016-03-19BugfixesSergey Poznyakoff1
* src/pies.c (main): Issue the start-up message after eventual changing to background and the corresponding reconfiguration of diagnostic output channel. * src/piesctl.c (parse_condition_to_uri, com_id): Fix checking for arguments.
2016-03-19Fix some compilation issues on SolarisSergey Poznyakoff1
* configure.ac: Check for libnsl * src/pies.c (string_to_syslog_facility): LOG_AUTHPRIV and LOG_FTP may be undefined. * src/piesctl.c (EX_NOTFOUND): Rename to EX_PIES_NOTFOUND. (com_list): Use default_cond. * src/sysvinit.c (console_stty): Make sure CBAUDEX is defined. * src/utmp.c (fill_utmp): Declare locals right before using them.
2016-03-07Improve docsSergey Poznyakoff1
* doc/pies.texi: Document piesctl and identity providers. * src/piesctl.c: Fix reference to the docs.
2016-02-26Minor fixSergey Poznyakoff1
2016-02-26piesctl: minor formatting changeSergey Poznyakoff1
2016-02-25Minor fixSergey Poznyakoff1
2016-02-25Implement "telinit environ" ctl commandSergey Poznyakoff1
* src/ctl.c: New endpoint "environ" * src/pies.h (sysvinit_envlocate) (sysvinit_envdelete) (sysvinit_envupdate): New protos. * src/piesctl.c: New subcommand "telinit environ". * src/sysvinit.c (sysvinit_envlocate) (sysvinit_envdelete) (sysvinit_envupdate): New functions. (sysvinit_begin): Create allocated copies of instance and pies_master_argv to avoid them being rewritten by calls to mf_proctitle_format
2016-02-24Improve parsing and handling of stop, start, and restart ctl commands.Sergey Poznyakoff1
* src/ctl.c (pcond_active): New type. (pcond_eval): Handle pcond_active. (pcond_conv): New op: active. (pcond_conv_find): Skip array elements with NULL term value. (object_to_cond): Permit empty argument if no handler function is defined. (fun_stop): Work on all prog types. (fun_start): Work only on components. (fun_restart): Work only on running components. * src/piesctl.c (cmdline_parser_state): New member: command. (pcond_parse_unary): Handle "active" keyword. (parse_condition): Change signature. (parse_condition_to_uri): Likewise. (default_cond): New function, (com_stop, com_start, com_restart): If no arguments supplied, assume default condition "type component". (ctlcom_t): Change signature. All uses changed. (main): Pass a pointer to cmdline_parser_state to the command handler.
2016-02-24Minor stylistic changeSergey Poznyakoff1
2016-02-23Improve loggingSergey Poznyakoff1
* po/POTFILES.in: Add missing source files. * grecs: Upgrade. * src/diag.c (pies_diag_printer): New function. (logfuncall): New function. * src/pies.h: Add new prototypes. * src/pies.c (main): Initialize grecs_print_diag_fun * src/acl.c: Uniformly use double-quotes in messages. Use logfuncall where applicable. * src/comp.c: Likewise. * src/ctl.c: Likewise. * src/inetd-bi.c: Likewise. * src/inetd.c: Likewise. * src/limits.c: Likewise. * src/piesctl.c: Likewise. * src/progman.c: Likewise. * src/socket.c: Likewise. * src/sysvinit.c: Likewise.
2016-02-20Improve control interfaceSergey Poznyakoff1
This commit implements the following operations on the new /conf endpoints: GET /conf/runtime - List configuration PUT /conf/runtime - Reload configuration POST /conf/runtime - Post new configuration GET /conf/files - List configuration files DELETE /conf/files - Delete some or all configuration files from the list POST /conf/files - Install new configuration file Piesctl supports the following new commands: piesctl config reload piesctl config file clear piesctl config file add SYNTAX NAME piesctl config file del[ete] NAME [NAME...] piesctl config file list * src/ctl.c (res_conf): New function. (restab): New endpoint /conf * src/pies.c (config_file_add): Set free_entry. (config_file_remove, config_file_remove_all) (config_file_list_serialize): New functions. (pies_config_parse): Bail out if tree processing fails. (pies_reload): Remove unused function. (main): Redo ACTION_RELOAD handling. Handle ACTION_COMMIT. * src/pies.h (ACTION_COMMIT): New action. (config_file_remove, config_file_remove_all) (config_file_list_serialize) (pies_read_config, progman_gc): New protos. * src/piesctl.c (cmdline_parser_state): New struct (next_token, peek_token): Take ptr to cmdline_parser_state as argument. (parse_error, require_token, assert_eol) (piesctl_format): New functions. (parse_condition_to_uri): Rewrite using piesctl_format. New subcommand: config. Improve help output.
2016-02-16Associate program's activity flag with prog, instead of with component.Sergey Poznyakoff1
The CF_DISABLED flag is still retained to indicate that the component is disabled administratively. * src/prog.h (prog.v.p) <active>: New member. (IS_ACTIVE_COMPONENT): Use active flag. * src/comp.c (component_finish): Don't modify component flags. * src/ctl.c (prog_serialize): Replace attribute "disabled" with "active". (fun_stop): Set prog->v.p.active * src/pies.c (main): Use pies_master_argv to check whether program name is absolute. * src/piesctl.c (print_comp): Check "active" attribute. * src/progman.c (register_prog0): Set prog->v.p.active. (progman_create_sockets): Remove components if their socket cannot be opened. (progman_lookup_tcpmux, prog_open_socket) (prog_start, progman_start) (prog_start_prerequisites, react): Operate on prog->v.p.active to test/change prog's activity state. * src/sysvinit.c (enablecomp, runlevel_setup_prog): Operate on prog->v.p.active to test/change prog's activity state. (demand_prog, IS_RUNNING_DISABLED_PROG): Likewise.
2016-02-13Stop disabled components when switching runlevels.Sergey Poznyakoff1
* src/prog.h (status_enabled, status_disabled): Remove. (status_stopped, status_running): New modes. All uses updated. * src/comp.c (component_finish): Disable ondemand component by default. * src/ctl.c (json_object_set_bool): New function. (pies_status_str): Update. (prog_serialize): Set "disabled" attribute. (fun_stop, fun_start): Use CF_DISABLED flag. (res_runlevel): Schedule ACTION_RELOAD. * src/pies.h (json_object_set_bool): New proto. * src/piesctl.c (status_trans): Reflect changes in modes. (print_comp): Check the "disabled" attribute. * src/progman.c (register_prog0) (prog_open_socket,prog_start,prog_stop) (progman_wake_sleeping) (prog_start_prerequisites) (react, progman_cleanup) (progman_stop_component): Update. (no_children_left): Fix. * src/sysvinit.c (enablecomp): Make CF_DISABLED flag persist for ondemand components. (runlevel_setup_prog): Use CF_DISABLED flag. (inittrans): Stop inactivated processes. * doc/pies.texi: Update.
2016-02-13Implement on-demaind components; implement control socket telinit interface.Sergey Poznyakoff1
* src/pies.h: Include json.h (sysvinit_report, sysvinit_set_runlevel) (json_object_set_string, json_object_set_number): New protos. * src/ctl.c (ctlio_resource)<predicate>: New member. (restab): New endpoint: runlevel. Available only if run as pid 1. (find_resource): If predicate is not NULL, call it to confirm that the endpoint is available. * src/piesctl.c: New subcommand "telinit". * src/sysvinit.c (sysvinit_set_runlevel): New function. (sysvinit_fifo_handler): Implement on-demaind components.
2016-01-10Minor changes in message wordingSergey Poznyakoff1
2016-01-09piesctl: optionally bind to local IPSergey Poznyakoff1
* configure.ac (GRECS_SETUP): Request sockaddr-list * grecs: Upgrade. * po/POTFILES.in: Remove meta.c * src/piesctl-cl.opt: Use client.url * src/piesctl.c (client_conn): New struct. (instance_keywords,piesctl_keywords): New keyword: "source". (parse_config): Initialize grecs_sockaddr_hints. (shttp_connect): Optionally bind to the selected local IP before connecting. * src/utmp.c (write_wtmpx,write_utmpx): Remove spurious notice.
2016-01-08Enable control socket when run as init process.Sergey Poznyakoff1
* configure.ac (DEFAULT_CONTROL_URL): Rename to DEFAULT_PIES_CONTROL_URL. Change default value. (DEFAULT_INIT_CONTROL_URL): New subst variable. * lib/libpies.h (pies_basic_url_create): New prototype. * lib/url.c (pies_basic_url_create): New function (renamed from pies_url_create). (pies_url_create): Expand variable references in the input string. * src/Makefile.am (AM_CPPFLAGS): Pass DEFAULT_INIT_CONTROL_URL * src/ctl.c (pies_control_url) (ctl_open): Don't exit on errors, return -1 instead. * src/pies.c (default_control_url): New variable. (config_parse): Create default socket url. (pies_control_url): New macro (main): Set environment variable PIES_INSTANCE. Try to open control socket in init process mode as well. * src/pies.h (default_control_url): New extern. (ctl_open): Change prototype. (pies_control_url): Remove. * src/piesctl-cl.opt (parse_options): Set environment variable PIES_INSTANCE. * src/piesctl.c (parse_config): Use pies_url_create and DEFAULT_PIES_CONTROL_URL when falling back to the default socket.
2016-01-06Revert to pre-32a337f3 two endpoint systemSergey Poznyakoff1
2016-01-05control interface: pass JSON as query for GET, DELETE, and PUTSergey Poznyakoff1
2016-01-05piesctl: normalize exit codes.Sergey Poznyakoff1
* src/piesctl.c (EX_OK, EX_NOTFOUND): New defines. (exit_status): New global. (all calls): Use EX_OK instead of literal 0 (shttp_process): Set exit_status on errors. (com_list, com_id): Return void. Check response code. (com_stop, com_start) (com_restart, com_reboot): Return void. (ctlcom_t): Return void. (main): Return exit_status
2016-01-05Include argv in the output of ctl id command.Sergey Poznyakoff1
* ctl.c (res_instance): Include "argv" in the return json. Use pies_master_argv[0] to report binary path. * pies.c (pies_master_argv,pies_master_argc): New globals. (main): Initialize them. Refuse to restart unless argv[0] begins with a slash. * pies.h (pies_master_argv,pies_master_argc): New globals. * piesctl.c (com_id): Rewrite output formatting.
2016-01-05Insert missing _() markersSergey Poznyakoff1
2016-01-05Select components to operate upon using conditional expressionSergey Poznyakoff1
* grecs: Upgrade. * src/ctl.c (restab): Split /programs in two endpoints. (eval_env): New members allowed_state, fun, total_count, success_count, and noperm_count. (pcond_type): pcond_and and pcond_or can take arbitrary number of arguments. All uses updated. (selector): Rewrite. * src/piesctl.c: All commands that operate on components take conditional expression as argument. (pcond_parse_and) (pcond_parse_or): Optimize consecutive operations.
2016-01-04Redo URI handling.Sergey Poznyakoff1
* src/ctl.c (res_instance) (res_programs): Take partial URI as argument (instead of full URI split on path delimiter) (ctlio_resource): New member uri_len; Change signature of handler. (find_resource): Compare URI prefix. (ctlio_do_command): Redo URI parsing. Improve error checking. * src/piesctl.c (shttp_print_error): New function. (shttp_fatal): Print error on 404 and 409 responses.
2016-01-04Minor fixesSergey Poznyakoff1
* src/ctl.c: Start textual descriptions with capital letters. * src/piesctl-cl.opt: Fix typos. * src/piesctl.c (shttp_process): Fix error handling. (shttp_fatal): Select exit code depending on the HTTP response code.
2016-01-04Improve piesctl help outputSergey Poznyakoff1
* src/piesctl.c (comtab): New members: argdoc and docstr. (command_help): New function. (main): Set proginfo.print_help_hook * po/POTFILES.in: add missing files.
2016-01-03Minor changesSergey Poznyakoff1
2016-01-02Switch to new control interface.Sergey Poznyakoff1
Old control options (--status, --restart-components) rewritten using piesctl. SIGUSR1 and SIGUSR2 no longer handled. * lib/arraymember.c (array_index): New function. * lib/libpies.h: Likewise. * src/cmdline.opt: Fix copyright years. * src/piesctl-cl.opt: Likewise. * src/ctl.c (ctlio_do_command): Implement restart. (pies_control_url): New function. (eval_env): rename json to result. New member cond. Restore pcond_ functions. (json_to_pcond): New function. (res_programs): Conditional selection of programs to list. Implement restart. * src/pies.c (ctlfile, statfile): Remove. (pies_keywords): Mark control-file and stat-file as inactive. (default_sigv): Remove SIGUSR1 and SIGUSR2 (pies_check_status): Don't send SIGUSR2. (stop_components): Remove. (request_restart_components): Rewrite as a wrapper. Call piesctl to do the job. (list_components): New function. * src/pies.h (ACTION_COMPRELOAD) (ACTION_DUMPSTATS): Remove. All callers changed. (progman_dump_stats): Remove. * src/piesctl.c (shttp_request_send): Don't initialize conn->req; the caller is responsible for that. (parse_condition, json_to_string) (parse_condition_to_uri): New functions. (com_list): Read conditional expression from the command line. (com_restart): Implement. * src/progman.c (progman_dump_stats): Remove.
2016-01-02piesctl: Implement all basic commands, except "restart"Sergey Poznyakoff1
2015-12-31Command-line control interface.Sergey Poznyakoff1
* configure.ac (DEFAULT_CONTROL_URL): New subst variable. * grecs: Upgrade. * ident/pam.c (overwrite_and_free): Free ptr. * lib/Makefile.am: Add new sources. * src/addrfmt.c: Move to lib/addrfmt.c * lib/grecsasrt.c: New file. * lib/grecsasrt.h: New file. * lib/mkfilename.c: New file. * lib/netrc.c: New file. * lib/pp.c: New file. * lib/split3.c: New file. * src/url.c: Move from lib/url.c (pies_url_free_user, pies_url_free_passwd): New finctions. * lib/libpies.h (strsplit3): New proto. (pies_url_create, pies_url_destroy) (pies_url_get_arg, pies_url_copy) (pies_url_free_user, pies_url_free_passwd) (netrc_scan) (pp_add_option, pp_command_line, mkfilename) (sockaddr_to_str, sockaddr_to_astr): New protos * src/Makefile.am (bin_PROGRAMS): New program: piesctl (pies_SOURCES): Remove addrfmt.c and url.c. (noinst_HEADERS, BUILT_SOURCES): Add piesctl-cl.h * src/cmdline.opt: Use pp_* function family to build preprocessor command line. * src/ctl.c (http_header_hash): Use case-insensitive hashing. (ctlio_finalize_reply): Don't close connection after sending 401 response. (input): Remove ws and wsflags. All uses changed. (input_append): Use strsplit3 to parse the request line. * src/pies.c: Use pp_* function family to build preprocessor command line. Move assert_, mkfilename and _cb+_url functions into libpies. * src/pies.h (pies_sockaddr_storage): Move to libpies.h * src/piesctl.c: New file. * src/piesctl-cl.opt: New file.

Return to:

Send suggestions and report system problems to the System administrator.