Age | Commit message (Collapse) | Author | Files |
|
* lib/addrfmt.c: Include limits.h
* src/ctl.c (fun_stop,fun_start): Ignore non-component
progs.
* src/pies.c (request_restart_components): Fix piesctl
invocation.
* src/pies.h (PIES_CHLD_RESCHEDULE_ALARM): New flag.
(progman_wait_until): Remove.
(progman_recompute_alarm): New proto.
* src/progman.c (recompute_alarm): Remove. All uses
raise PIES_CHLD_RESCHEDULE_ALARM instead.
(progman_wake_sleeping): Handle status_stopping components
independently on their activity flag.
(prog_stop_all, progman_wait_until): Remove.
(progman_stop): Rewrite using mark+sweep approach.
|
|
* 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.
|
|
* src/inetd-bi.c (tcpmux): Use component_foreach to
handle help requests.
* src/progman.c (progman_iterate_comp): Removed.
* src/pies.h: Likewise.
|
|
This complements 6aac230c. The entry is created unless
a component for runlevel S already exists.
* src/comp.c (component_foreach): New function.
* src/pies.h: Likewise.
* src/sysvinit.c (inittab_parse): Provide default S
entry unless one is already defined.
|
|
Improper dereferencing occurred when trying to access master
prog of a redirector.
* src/prog.h (prog) <r.comp>: New member.
* src/progman.c (destroy_prog) <TYPE_COMPONENT>: Clear master
pointers in both redirectors.
<TYPE_REDIRECTOR>: Check if master is NULL.
(register_redir): Initialize r.comp.
|
|
|
|
* grecs: Upgrade.
* src/acl.c (_acl_common_section_parser): Free old value.
* src/pies.c: Mark statically initialized keywords with
GRECS_CONST.
|
|
* src/pies.c (_cb_command,_cb_env): Free wordsplit struct.
(main): Allocate log_tag. Otherwise it might get overwritten
by mf_proctitle_format.
|
|
* src/sysvinit.c (inittab_parse): Provide default entry if
inittab cannot be read or if it defined no components.
* src/comp.c (component_list_is_empty): New function.
* src/pies.c (pies_read_config): Always return 0 in init mode.
(main): Use LOG_DAEMON in init mode.
* src/pies.h (component_list_is_empty): New proto.
|
|
* src/comp.c (component_config_commit): Correctly handle
empty list of components.
|
|
* src/pies.c (main): Use pies_master_argv when restarting.
|
|
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.
|
|
* src/pies.h (PIES_CHLD_GC): New op.
(progman_stop_tag): Remove proto.
* src/pies.c (main): Handle PIES_CHLD_GC: stop all programs marked
for termination.
* src/comp.c (component_config_commit): Mark leftover components
for termination, instead of waiting for them to terminate.
* src/sysvinit.c (runlevel_setup_prog): Skip prog if its
active status didn't change.
Mark inactivated progs for termination.
(sysvinit_runlevel_setup): Schedule PIES_CHLD_GC.
(inittrans): Don't wait for programs to terminate. That will be done
in the main loop.
* src/prog.h (prog)<stop>: New boolean member.
* src/progman.c (progman_cleanup)
(progman_stop_component): Clear the stop flag.
(progman_gc): New function.
(progman_stop_tag): Remove.
|
|
* src/progman.c (link_prog): Take a pointer to the reference prog
as the second argument. Link the first argument after that reference
prog, or at the head of the list if the reference is NULL.
(register_prog0): Make sure progs are linked exactly in the same order
as the corresponding components.
(prog_create_socket): Process only progs with status == status_listener
(progman_start): Do the right thing depending on the prog type.
|
|
* src/ctl.c (prog_active): New function.
(prog_serialize): Use prog_active to report prog's activity state.
For listener components, return also their service and tcpmux master
names, if applicable.
(fun_stop): Stop listeners as well.
(fun_start): Start listeners.
(ctlio_end): Don't close fd: this is done by deregister_socket
* src/inetd-bi.c (tcpmux_help): Don't list inactive components.
* src/prog.h (prog_activate_listener)
(prog_deactivate_listener): New protos.
* src/progman.c (prog_lookup_by_tag)
(prog_lookup_by_service): Remove.
(progman_cleanup): Fix coredump (premature free).
(progman_stop_component): If component is a listener, deactivate it.
(prog_activate_listener)
(prog_deactivate_listener): New functions.
* src/socket.c (delete_sockinst): Close the socket descriptor.
* src/sysvinit.c (sysvinit_fifo_handler, create_fifo): Don't close fd,
leave that to deregister_socket.
|
|
* src/diag.c: Rewrite.
(vdiagmsg,diagmsg): New functions.
* src/pies.c (main): Set DIAG_REOPEN_LOG for init process.
* src/pies.h (DIAG_REOPEN_LOG): New flag
(DIAG_TO_MASK,DIAG_ALL): New constants.
(diagmsg): New proto.
* src/sysvinit.c: Add log messages in important transition points
(inittrans): Reinitialize logging to syslog upon transition to
normal mode.
|
|
* src/pies.c (main): Move call to pies_schedule_children
to inittrans.
* src/progman.c (progman_cleanup): Minor change.
* src/sysvinit.c (enablecomp): Change prog status
to stopped when leaving its runlevel.
(sysvinit_set_runlevel): Raise SIGALRM instead of calling
inittrans directly.
(inittrans): Fix wait logic.
|
|
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.
|
|
* src/pies.c (main): Move init-specific command line
handling to sysvinit_parse_argv.
* src/pies.h (dfl_level): Remove extern.
(sysvinit_parse_argv): New proto.
* src/sysvinit.c (sysvinit_parse_argv): New function.
(sysvinit_begin): Start emergency shell, if requested.
|
|
* src/pies.h (PIES_COMP_WAIT): Remove.
(PIES_COMP_MASK): Save one bit.
(PIES_CHLD_NONE, PIES_CHLD_CLEANUP)
(PIES_CHLD_WAKEUP): New constants.
(pies_schedule_children): New proto.
(sysvinit_runlevel_setup): Change signature.
* src/pies.c (children_cleanup, got_alarm): Merge into
single static variable children_op. All uses updated.
(pies_schedule_children): New function.
(sig_handler): Update
(main): Don't call ctl_open for init process. It is done
by inittrans after transition from boot to normal state.
Update to use pies_schedule_children.
* src/prog.h (IS_ACTIVE_COMPONENT): New macro.
* src/progman.c (prog_start): Don't modify prog->v.p.wait.
(progman_wake_sleeping): Start usual components only after
all "wait" components have terminated.
(progman_cleanup): If a "wait" component has terminated,
request PIES_CHLD_WAKEUP.
* src/sysvinit.c (enstate) <wait>: Remove.
(enablecomp): Update.
(runlevel_setup_prog): Set prog->v.p.wait.
(sysvinit_runlevel_setup): Take only one parameter.
(inittrans): Remove "wait" and the related mess.
Call ctl_open after transition boot -> normal.
|
|
* 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.
|
|
* 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.
|
|
|
|
* src/progman.c (progman_foreach): Allow filter to remove its prog
argument from the list. Return integer (result of the call
to filter, that returned non-zero). All uses changed.
(progman_running_count): Remove.
(progman_stop_component): Take a pointer to
pointer. Pass it to destroy_prog when needed. All uses changed.
* src/comp.c (prog_is_leftover): New function.
(cb_terminate_prog): Use prog_is_leftover. Don't raise CF_DISABLED
flag, as prog will have been destroyed by progman_stop_component.
(cb_kill_prog): Use prog_is_leftover.
* src/ctl.c (fun_stop): Check if prog still exists after the
call to progman_stop_component.
* src/pies.h (progman_running_count): Removed.
* src/prog.h (progman_foreach): Return int.
(progman_stop_component): Change signature.
|
|
|
|
* src/ctl.c (fun_start): Handle status_finished same as
status_sleeping (for restarting ondemand components).
* src/progman.c: Respawn ondemand components.
* src/sysvinit.c (enablecomp): Handle pies_comp_ondemand.
(sysvinit_demand): New function.
(sysvinit_fifo_handler): Handle ondemand runlevels.
(inittab_parse): Support "off" fields.
Convert runlevels to upper case.
|
|
* src/ctl.c (prog_serialize): List runlevels.
* src/pies.c (main): Set got_alarm after reloading configuration.
Handle ACTION_POWER.
* src/pies.h (ACTION_POWER): New constant.
(progman_running_p): Rename to progman_waiting_p. All uses changed.
(sysvinit_power): New proto.
(POWER_STAT_FILE): New define.
(POWER_STAT_FAIL,POWER_STAT_LOW,POWER_STAT_OK): New constants.
* src/prog.h (prog) <idx>: Remove.
(prog) <wait>: New member.
* src/progman.c (prog_lookup_by_idx): Remove.
(progman_waiting_p): Return 1 only if there is at least one
prog with v.p.wait set.
(prog_start): Initialize v.p.wait for sysvinit components.
(progman_start): Don't do anything if waiting for components from
the previous runlevel.
(progman_wake_sleeping): Likewise.
(progman_cleanup): Assume expect_term if waiting for components from
the previous runlevel.
Clear v.p.wait on exited progs.
* src/sysvinit.c (sysvinit_fifo_handler): Don't call progman_stop
when handling runlevel changes.
Handle INIT_CMD_POWERFAIL, INIT_CMD_POWERFAILNOW, and
INIT_CMD_POWEROK.
(sysvinit_sigtrans): Handle SIGPWR.
(is_comp_wait): Rewrite.
(power_stat_file): New variable.
(sysvinit_power): New function.
|
|
* src/comp.c (component_link): Always link after the REF.
component. If REF is NULL, link at list head.
(component_append): New function.
(component_create): Use component_append.
(component_free): Fix double-free.
* src/pies.c (pies_reload): Call sysvinit_runlevel_setup.
* src/progman.c (progman_stop_component): Remove inactive
components.
* src/sysvinit.c (sysvinit_fifo_handler): Schedule ACTION_RELOAD.
on receiving INIT_CMD_RUNLVL.
(sysvinit_sigtrans): Don't handle SIGHUP.
|
|
|
|
* src/comp.c (component_link): Restore "next" link.
|
|
Implement clean configuration reload on SIGHUP.
Use SIGUSR1 to restart the program (previously initiated by SIGHUP).
* src/Makefile.am (pies_SOURCES): Add comp.c
* src/comp.c: New file.
* src/acl.c (pies_acl_free): Don't coredump on NULL arg.
(_parse_from): Set cmp function for the sockaddr list.
(_acl_common_section_parser): Set cmp function for the ACL
(pies_acl_cmp): New function.
* src/acl.h (pies_acl_cmp): New proto.
* src/cmdline.opt: Remove option --dump-prereq. Add options
--trace-prereq and --trace-depend.
* src/ctl.c: Use prog_tag to access tag of struct prog.
* src/depmap.c (depmap_clear)
(depmap_clear_all): New functions.
* src/inetd.c (inetd_conf_file): Don't register prog right
away. This is done later in component_config_commit.
(inetd_parse_conf): Rename to inetd_config_parse.
* src/limits.c (limits_cmp): New function.
* src/pies.c (config_file): Replace with struct config_syntax.
(str_to_config_syntax): Return a pointer to struct config_syntax.
(add_config): Rename to config_file_add.
(config_file_add_type): New function.
(return_code_keywords, create_action): Change handling of actions.
(return_code_section_parser): Likewise.
(component_verify, component_create)
(component_free, component_finish): Move to comp.c
(config_parse): Remove.
(pies_config_parse): New function.
(pies_read_config,pies_reload): New function.
(pies_reload): Rename to request_reload.
(pies_status): Rename to request_status.
(pies_stop): Rename to request_stop.
(main): Change configuration file handling.
SIGHUP reloads configuration, instead of restarting the program.
(default_sigv,sig_handler): Handle SIGUSR1.
* src/pies.h (component): New members: prev, next, listidx, arridx,
ref_count, prog.
Remove act_head, act_tail, act_temp.
Add new prototypes.
* src/prog.h (prog): Remove tag and prereq.
* src/progman.c (prog_tag): New function.
(destroy_prog): Update component reference count.
(register_redir): Likewise.
(register_prog0): Take one argument.
Update component reference count.
(register_prog): Update comp->prog
(prog_rebuild_prerequisites): Remove.
(component_fixup_depend): Remove.
(fixup_prerequisites,rebuild_prerequisites)
(print_dep,progman_dump_prereq)
(progman_dump_depmap,progman_build_depmap): Remove.
(prog_start_prerequisites): Scan depmap to find prerequisites.
(prog_stop_dependents): Likewise.
(progman_wait): Remove.
(progman_wait_until): New function.
(progman_stop): Rewrite using progman_wait_until.
(react): Rewrite using grecs_list
* src/sysvinit.c: Use prog_tag when needed.
* src/userprivs.c (pies_privs_cmp, pies_privs_free): New functions.
* grecs: Update.
* lib/safe_strcmp.c: New file.
* lib/Makefile.am: Add safe_strcmp.c
* lib/libpies.h (safe_strcmp): New proto.
|
|
|
|
* src/progman.c (print_status): Suppress output if running
as init process, unless in debug mode.
* src/sysvinit.c (sysvinit_begin): Set up "non-failing"
memory allocation.
|
|
|
|
* src/ctl.c (ctl_open): Return immediately if
control.url is null.
(fun_start): Start sleeping component.
* src/meta1lex.h: Removed.
* src/pies.c (config_parse): Move creation of the default
control.url to main.
|
|
|
|
* configure.ac (GRECS_SETUP): Require parser-meta1
* grecs: Upgrade.
* po/POTFILES.in: Update.
* src/Makefile.am: Remove meta1gram.y and meta1lex.l
Add meta1parse.c and meta1parse.h
* src/meta1gram.y: Remove.
* src/meta1lex.l: Remove.
* src/meta1parse.c: New file.
* src/meta1parse.h: New file.
* src/pies.c: Include meta1parse.h instead of meta1lex.h
|
|
* src/meta1gram.y: Translate "wait" mode to "exec".
* src/diag.c (logmsg_vprintf): Don't loose the last segment before \n.
|
|
* 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.
|
|
* gnulib.modules: Remove unneded modules.
* ident/ident.h: Remove xalloc.h, include errno.h
* ident/ident.c: Use standard allocation functions instead of x*
* ident/pam.c: Remove.
* ident/provider.c: Remove.
* ident/system.c: Remove.
* src/meta.c: Remove.
* src/Makefile.am: Remove meta.c
* src/progman.c: Use grecs_* allocation functions instead of x*.
(notify): Use wordsplit to expand variables within message.
Rename variables: program-name to program_name;
canonical-program-name to canonical_program_name.
* doc/pies.texi: Update.
* src/depmap.c: Use grecs_* allocation functions instead of x*.
(depmap_end): New function.
* src/diag.c (logmsg_vprintf): Use grecs_txtacc instead of obstack.
* src/pies.h (depmap_end): New proto.
Remove unused includes.
* src/acl.c: Use grecs_* allocation functions instead of x*.
* src/ctl.c: Likewise.
* src/inetd.c: Likewise.
* src/limits.c: Likewise.
* src/meta1gram.y: Likewise.
* src/meta1lex.l: Likewise.
* src/pies.c: Likewise.
* src/socket.c: Likewise.
* src/sysvinit.c: Likewise.
* src/userprivs.c: Likewise.
|
|
* 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.
|
|
* lib/addrfmt.c (S_UN_NAME): Fix comparison.
(sockaddr_to_str): Improve wording.
|
|
* bootstrap.conf (bootstrap_epilogue): Declare the package as a
GNU one.
* configure.ac: Require gettext 0.19
Remove useless conditional
* src/ctl.c (fun_stop, fun_start): Check prog->v.p.status, not the
CF_DISABLED flag.
|
|
|
|
|
|
* 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
|
|
* 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.
|
|
* src/ctl.c (ctlio_authenticate): Configurable realm name.
(ctlio_do_command): Check the Accept header.
* src/inetd.c (inetd_conf_file): Change line_no type.
* src/pies.c (control_keywords): New keyword: realm.
* src/pies.h (control) <realm>: New member.
|
|
|
|
* 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.
|