diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2016-01-21 08:31:31 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2016-01-21 08:31:31 +0200 |
commit | 0c930fc6d3fde82e800c685ec1df92ddfa23fe09 (patch) | |
tree | 1494ff68c9006d3e1a9d6ab5b3b2a5e2f66a47ca /src/prog.h | |
parent | 2040ea870ae411472a73d0bee49fb7c4a774ad93 (diff) | |
download | pies-0c930fc6d3fde82e800c685ec1df92ddfa23fe09.tar.gz pies-0c930fc6d3fde82e800c685ec1df92ddfa23fe09.tar.bz2 |
Cleanup: redo configuration file handling and dependency tracking.
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.
Diffstat (limited to 'src/prog.h')
-rw-r--r-- | src/prog.h | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -46,8 +46,6 @@ struct prog | |||
46 | struct prog *next, *prev; | 46 | struct prog *next, *prev; |
47 | enum prog_type type; | 47 | enum prog_type type; |
48 | pid_t pid; /* PID */ | 48 | pid_t pid; /* PID */ |
49 | char *tag; /* Entry tag (for diagnostics purposes) */ | ||
50 | char **prereq; | ||
51 | int facility; | 49 | int facility; |
52 | union | 50 | union |
53 | { | 51 | { |
@@ -60,7 +58,6 @@ struct prog | |||
60 | time_t timestamp; /* Time of last startup */ | 58 | time_t timestamp; /* Time of last startup */ |
61 | size_t failcount; /* Number of failed starts since timestamp */ | 59 | size_t failcount; /* Number of failed starts since timestamp */ |
62 | enum prog_status status; /* Current component status */ | 60 | enum prog_status status; /* Current component status */ |
63 | char *runlevels; | ||
64 | /* If status == status_listener: */ | 61 | /* If status == status_listener: */ |
65 | size_t num_instances; /* Number of running instances */ | 62 | size_t num_instances; /* Number of running instances */ |
66 | /* If comp->type == pies_comp_inetd && status == status_enabled */ | 63 | /* If comp->type == pies_comp_inetd && status == status_enabled */ |
@@ -72,11 +69,13 @@ struct prog | |||
72 | 69 | ||
73 | struct | 70 | struct |
74 | { | 71 | { |
72 | char *tag; | ||
75 | struct prog *master; | 73 | struct prog *master; |
76 | } r; | 74 | } r; |
77 | 75 | ||
78 | struct | 76 | struct |
79 | { | 77 | { |
78 | char *tag; | ||
80 | char *command; | 79 | char *command; |
81 | } c; | 80 | } c; |
82 | } v; | 81 | } v; |
@@ -88,3 +87,5 @@ struct prog *progman_locate (const char *name); | |||
88 | void progman_foreach (int (*filter) (struct prog *, void *data), void *data); | 87 | void progman_foreach (int (*filter) (struct prog *, void *data), void *data); |
89 | void prog_stop (struct prog *prog, int sig); | 88 | void prog_stop (struct prog *prog, int sig); |
90 | void progman_stop_component (struct prog *prog); | 89 | void progman_stop_component (struct prog *prog); |
90 | |||
91 | char const *prog_tag (struct prog const *prog); | ||