Age | Commit message (Collapse) | Author | Files |
|
|
|
* lib/envop.c (envop_cmp): Fix coredump on name == NULL (eval statement
in env).
* lib/pp.c: Add missing include.
* src/comp.c: Fix format conversions.
* src/pies.c (main): Call gc early, so that old components are stopped
before starting new ones. Don't raise PIES_CHLD_WAKEUP.
* src/progman.c (progman_gc): Call progman_cleanup before checking if
any programs are left running.
Fix format conversions.
|
|
* NEWS: Document changes.
* doc/pies.texi: Document changes.
* src/cmdline.opt: New option --list-shutdown-sequence
* src/comp.c (compute_shutdown_sequence)
(component_shutdown_list,components_list_shutdown_sequence)
(components_shutdown_sequence_numbers): New functions.
(component_config_commit): Compute shutdown sequences for
each component.
* src/pies.c: Handle the --list-shutdown-sequence option.
* src/pies.h (component) <shutdown_seqno>: New field.
(components_list_shutdown_sequence)
(components_shutdown_sequence_numbers): New prototypes.
* src/progman.c (progman_gc): Rewrite.
(progman_stop): Rewrite.
* tests/shdnseq.at: New test.
* tests/sigwait.c: Take options -n and -f FILE.
Open file in append mode. Lock it before writing.
* tests/Makefile.am: Add new test.
* tests/testsuite.at: Include new test.
|
|
* NEWS: Document changes.
* doc/pies.texi: Document changes.
* src/comp.c (component_create): Initialize sigterm field.
* src/pies.h (component): New field: sigterm.
* src/pies.c (strtosignum): New function.
(create_action): Use strtosignum.
(_cb_signal): New callback.
(component_keywords): New keyword "sigterm".
* src/progman.c (prog_sigterm): New function.
(link_prog, progman_cleanup)
(progman_stop_component): Use prog_sigterm.
(print_status): Change semantics of expect_term: it means termination
signal, if not 0.
* tests/sigterm.at: New test.
* tests/sigwait.c: New test program.
* tests/Makefile.am: Add new test.
(noinst_PROGRAMS): Add sigwait.
* tests/testsuite.at: Include new test.
|
|
|
|
* lib/envop.c (environ_free): Free the env block itself.
(envop_cmp): New function.
* lib/envop.h (envop_cmp): New proto.
* src/comp.c (argvcmp): Fix segmentation fault that occurred when
both a and b were NULL.
(component_match): Compare command, envop, and umask.
|
|
|
|
* NEWS: Update.
* doc/pies.texi: Update.
* src/pies.h (component): Remove the facility field.
* src/comp.c: Likewise.
* configure.ac: Select interface to use to close fds (imported from
mailutils).
* lib/closefds.c: New file (imported from mailutils).
* lib/Makefile.am: Add closefds.c
* lib/libpies.h (pies_close_fds): New proto.
* src/pies.c: Use pies_close_fds
* src/progman.c: Likewise.
|
|
Instead of spawning a subprocess for each redirection, read the
output directly from pipe and send it to syslog using an asynchronous
syslog implementation.
* src/syslog.c: New file.
* src/pies_syslog.h: New file.
* src/Makefile.am: Add syslog.c and pies_syslog.h
* src/comp.c (component_create): Use pies_log_facility.
* src/ctl.c (auth_prog)
(prog_serialize): Remove TYPE_REDIRECTOR case
* src/diag.c (syslog_printer): Use pies_vsyslog.
(syslog_open): Use pies_syslog_open.
(syslog_close): Use pies_syslog_close.
(diag_setup): Use pies_syslog_open.
* src/pies.c (log_facility, log_tag): Remove globals. Use
pies_log_facility and pies_log_tag instead.
New configuration statement syslog.dev
* src/pies.h: Include pies_syslog.h
(register_socket,register_program_socket): Additional argument: free_data.
* src/prog.h (TYPE_REDIRECTOR): Remove.
(prog.v.p.redir): Change data type.
(prog.v.r): Remove.
* src/progman.c (prog_tag)
(destroy_prog)
(progman_cleanup): Remove TYPE_REDIRECTOR case
(prog_stop_redirectors): Deregister fds
(redir_tag,register_redir)
(update_redir): Remove.
(open_redirector): Rewrite. Set up direct reader from the stream,
instead of spawning a subprocess.
(prog_start): Change open_redirector actual arguments.
* src/socket.c (sockinst): New member: free_data.
(register_socket): Initialize the free_data member.
(register_program_socket): Likewise.
|
|
* NEWS: Update.
* doc/pies.texi: Document the expandenv flag.
* src/comp.c (component_finish): Warn if both "shell" and "expandenv"
are used together.
Expand command to argc/argv only unless the CF_EXPANDENV flag is given.
* src/pies.c (str_to_cf): New flag: expandenv
* src/pies.h (CF_EXPANDENV): New define.
* src/prog.h (struct prog): New member: argv.
* src/progman.c (destroy_prog): Free argv.
(prog_start_prologue): Expand the command line taking into account
the current environment if CF_EXPANDENV flag is given. Otherwise,
copy the component argv to the prog.
(prog_execute): Use prog->v.p.argv
* tests/Makefile.am: Add expandenv.at
* tests/testsuite.at: Likewise.
* tests/expandenv.at: New file.
|
|
Use modified Floyd-Warshall algorithm for cyclic dependecy detection.
The computed next vertex indices are used when reporting the cycles
found.
This fixes dead loops that occurred in earlier versions when trying to
report cycles. One of inputs that caused such behavior is used as a
new test in cyclic.at.
* src/depmap.c: Rewrite using modified Floyd-Warshall algorithm.
(depmap_cycle_detect,depmap_path_free): New functions.
* src/comp.c (report_cyclic_dependency): Take struct depmap_path *
as argument.
(component_build_depmap): Use depmap_cycle_detect to detect cyclic
dependencies.
(depmap_dump): Special handling for zero-sized depmap.
* tests/cyclic.at: Add new test.
* src/pies.h (depmap_dim, depmap_free)
(depmap_cycle_detect,depmap_path_free): New protos.
* NEWS: Document changes.
|
|
|
|
* configure.ac: New option --enable-sysvinit. Disable the init
code if RUN_LVL is not available.
(PIES_SYSVINIT_ENABLED): New configuration define.
(PIES_COND_SYSVINIT): New condition
Print configuration settings summary.
* src/pies.h (is_sysvinit): Check for PIES_SYSVINIT_ENABLED.
(SYSVINIT_ACTIVE): New macro.
* grecs: Upgrade.
* src/Makefile.am: Conditionally link sysvinit-related code.
* src/cmdline.opt: Disable the --telinit option if sysvinit support
is not available.
(parse_options): Use SYSVINIT_ACTIVE in the conditional.
* src/comp.c (component_verify): Check if component definition is
allowed by the current state of the sysvinit support.
* src/ctl.c: Disable the /runlevel entry point if sysvinit support
is not compiled.
* src/diag.c (stderr_open): Make sure sysvinit-related code is not
compiled if the sysvinit support is not available.
* src/pies.c (config_syntax_tab): Add entry for CONF_INITTAB only if
sysvinit support is available.
(_cb_initdefault,_cb_runlevels): Remove. Use cb_initdefault and cb_runlevels
instead.
(component_keywords): Disable runlevels without sysvinit support.
(pies_keywords): Same for initdefault.
Use SYSVINIT_ACTIVE to suppress compilation of sysvinit code without
sysvinit support.
* src/progman.c: Use SYSVINIT_ACTIVE to suppress compilation of
sysvinit code without sysvinit support.
* src/sysvinit.c (cb_initdefault,cb_runlevels): New functions.
|
|
* src/comp.c (component_verify,component_finish): Fix check for
the presense of the "command" statement.
* src/pies.c (component_keywords): Reorder some entries for
the consistency of config-help output.
* tests/.gitignore: Add new files.
* tests/Makefile.am: Add new tests and noinst programs.
* tests/accept.at: New test.
* tests/builtin.at: New test.
* tests/chargen.c: New file.
* tests/readtime.c: New file.
* tests/recvfd.c: Rewrite for testing both accept and pass-fd components.
* tests/passfd.at: Pass -s option to recvfd
* tests/testsuite.at: Add new tests.
* tests/lines.c: Minor changes.
* tests/nt.c: Minor changes.
* tests/to.c: Minor changes.
|
|
* src/comp.c (component_build_depmap): Defer removal of the
component to the end of the run
|
|
It no longer requires an argument. The correct syntax is
env {
clear;
}
|
|
* configure.ac (GRECS_SETUP): Request the tree-api
* grecs: Pull a0c096190f
* lib/envop.c (environ_set): Call wordsplit_free unconditionally.
* lib/grecsasrt.c (assert_grecs_value_type)
(assert_scalar_stmt): Remove.
(conf_callback_url): Switch to tree-api.
* lib/grecsasrt.h: Likewise.
* src/acl.c: Rewrite grecs callbacks in the tree API style.
Use grecs assertions.
* src/acl.h: Likewise.
* src/meta1parse.c: Likewise.
* src/pies.c: Likewise.
* src/piesctl.c: Likewise.
* src/comp.c (component_finish): Check whether the "command" statement
was used.
|
|
The "env" statement is now a compound statement. It can contain four
substatements: "clear" to clear the environment, "keep" to retain
certain variable while clearing it, "set" to set a variable, and
"unset" to unset a variable or variables.
Both "keep" and "unset" can take globbing pattern as their argument,
in which case they affect all variable matching that pattern.
The value part in the "set" statement is subject to variable expansion,
e.g.
set "MANPATH=$MANPATH${MANPATH:+:}/usr/local/man"
The support for the old one-line syntax of "env" is retained for
backward compatibility.
This commit also fixes redirection to a file: new data are appended
to the file, instead of overwriting it.
* lib/Makefile.am: Add new files.
* lib/envop.c: New file.
* lib/envop.h: New file.
* lib/wildmatch.c: New file.
* src/comp.c (component_free): Update.
* src/pies.c (argv_free): New function.
(parse_legacy_env): New function.
(_cb_env): Remove.
(cb_env_section_parser): New function.
(cb_env_keywords): New keywords for the "env" block statement:
clear, keep, set, unset.
(component_keywords): New compount statement: env.
Old usage retained for backward compatibility.
* src/pies.h: Include "envop.h"
(component)<env>: Remove.
<envop>: New field.
* src/prog.h (prog)<env>: New field.
* src/progman.c (redirect_to_file): Position to the end of file.
(DEBUG_ENVIRON): Remove macro.
(debug_environ): New function.
(environ_setup): Remove.
(prog_sockenv): Use environ_set to modify local copy of environment.
(prog_start_prologue): Use environ_create + envop_exec to create and
modify the environment.
(prog_execute): Set environment to prog-local copy.
* tests/.gitignore: Build envtest
* tests/Makefile.am: Add new tests.
* tests/testsuite.at: Add environment tests.
* tests/envop.at: New file.
* tests/envtest.c: New file.
* tests/env.at: New file.
* tests/redirect.at: Check first two lines of the output file.
|
|
The new flag "shell" instructs pies to run the command marked with it
as '/bin/sh -c $command'. Alternative shell can be supplied ising the
'program' statement.
This is useful if the command line uses shell-specific features (command
or variable expansion, redirection, pipes, etc.)
This commit also fixes a bug in the 'env' statement handling: a single
argument with embedded whitespaces was undergoing word splitting and
thus incorrectly handled as multiple arguments.
* NEWS: Document changes.
* doc/pies.texi: Likewise.
* src/comp.c (component_free): Free command.
(component_finish): Split command into argv/argc as directed by the
CF_SHELL flag.
* src/pies.c (_cb_command): Remove. Functionality moved to
component_finish().
(_cb_env): Bugfix. Don't split arguments.
* src/pies.h (CF_SHELL): New flag.
(component) <command>: New member.
* tests/Makefile.am: Add new tests.
* tests/testsuite.at: Add new tests.
* tests/aux/respawn: Change default timeout to 1 second.
* tests/respawn.at: Minor change.
* tests/shell.at: New test.
|
|
* 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.
|
|
These are components that are run at program startup. Starting
other components is delayed until all startup components terminate.
This is similar to SysV "bootwait" components.
Upon termination, startup components are removed from the configuration.
They are not renewed upon configuratuion reload.
* src/comp.c (comp_array_remove): Remove from the depmap as well.
(component_ref_decr): Use comp_array_remove for active components
and plain component_free for inactive ones.
(component_build_depmap): Use comp_array_remove.
(component_config_commit): Special handling for pies_comp_startup
components.
* src/pies.c (modetab): New component modes: "startup" and "shutdown".
(main): Run program_init_startup.
* src/pies.h (pies_comp_mode): New modes: pies_comp_startup and
pies_comp_shutdown.
(program_init_startup): New proto.
* src/progman.c (progman_waiting_p): Return 1 if a startup component
is still running.
(program_init_startup): New function.
(progman_cleanup): Handle pies_comp_startup termination.
* src/socket.c (switch_eids): Avoid unnecessary calls to setegid
and seteuid.
* tests/atlocal.in (auxdir): New variable.
* tests/mailer: Move to tests/aux/
* tests/respawn: Move to tests/aux/
* tests/retcode: Move to tests/aux/
* tests/aux/startup: New auxiliary program.
* tests/redirect.at: Start components from $auxdir.
* tests/respawn.at: Likewise.
* tests/ret-exec.at: Likewise.
* tests/ret-notify.at: Likewise.
* tests/startup.at: New file.
* tests/testsuite.at: Include startup.at
* tests/Makefile.am: Add new tests.
|
|
|
|
* src/comp.c (component_log_dep): Remove.
(report_cyclic_dependency): New function.
(comp_array_remove): New function.
(component_build_depmap): Remove erroneous components both from
the component table and dependency map.
(components_dump_depmap): Avoid trailing whitespace in the output.
* src/depmap.c (depmap_clear_all): Remove.
(depmap_remove): New function.
* src/pies.h (CF_REMOVE): New flag.
(depmap_clear_all): Remove prototype.
(depmap_remove): New prototype.
* tests/Makefile.am: Add new test.
* tests/atlocal.in (trimws): New function.
* tests/cyclic.at: New test.
* tests/testsuite.at: Include new test.
|
|
Coredump was triggered by detected cyclic dependency.
|
|
Spotted by Rafael Fontenelle.
|
|
|
|
All ACL keywords can be used in simple statement as well as in block form.
As simple statements, they take a name of an already defined named ACL. E.g.:
defacl forbid {
deny any;
}
component foo {
list-acl forbid;
}
This commit also fixes some eventual double-frees.
* doc/pies.texi: Update.
* src/acl.c (pies_acl)<refcnt>: New member.
(pies_acl_use): New function.
(pies_acl_create): Initialize refcnt.
(pies_acl_destroy): New function.
(pies_acl_free): Rewrite as a wrapper over pies_acl_destroy.
(_parse_sub_acl): Call pies_acl_use when installing a named ACL.
(_acl_common_section_parser): Handle grecs_callback_set_value.
* src/acl.h (pies_acl_destroy)
(pies_acl_use): New function.
* src/comp.c (component_free): Free acl.
|
|
* src/comp.c (component_verify): Fix stdout redirection check.
* src/meta1parse.c (meta1_translate_node): Skip simple statements.
(meta1_translate_node): Allocate comp->dir
* doc/pies.texi: Use @example instead of @smallexample
|
|
* comp.c (mark_prog): Instead of calling progman_gc, terminate the
prog if it is a deactivated listener.
|
|
* src/comp.c (component_config_commit): Run progman_gc right
after mark stage, to ensure any eventual listener components
are properly closed before being reopened by progman_create_sockets
|
|
* src/prog.h (prog): Remove .facility. Use facility from
the component.
(active,wait,stop): Move from union into the main struct.
All uses changed.
|
|
* 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.
|
|
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.
|
|
* 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.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.
|
|
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/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/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/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.
|