diff options
Diffstat (limited to 'src/pies.h')
-rw-r--r-- | src/pies.h | 57 |
1 files changed, 46 insertions, 11 deletions
@@ -98,7 +98,6 @@ enum return_action struct action { - struct action *next; size_t nstat; unsigned *status; enum return_action act; /* Action to take when the component terminates */ @@ -202,8 +201,16 @@ enum pies_comp_mode #define ISCF_TCPMUX(f) ((f) & (CF_TCPMUX | CF_TCPMUXPLUS)) +struct prog; + struct component { + struct component *prev, *next; /* Components form doubly-linked list. */ + int listidx; /* Index of the list. */ + size_t arridx; /* Index of this component. */ + size_t ref_count; /* Reference count. */ + struct prog *prog; /* Prog associated with this component. */ + enum pies_comp_mode mode; char *tag; /* Entry tag (for diagnostics purposes) */ char *program; /* Program name */ @@ -217,7 +224,7 @@ struct component size_t max_instances; /* Maximum number of simultaneously running instances */ char *rmfile; /* Try to remove this file before starting */ - struct pies_privs privs; /* UID/GIDS+groups to run under */ + struct pies_privs privs; /* UID/GIDS+groups to run as */ mode_t umask; /* Umask to install before starting */ limits_record_t limits; /* System limits */ @@ -249,8 +256,7 @@ struct component int facility; /* Syslog facility. */ struct redirector redir[2]; /* Repeaters for stdout and stderr */ /* Actions to execute on various exit codes: */ - struct action *act_head, *act_tail; - struct action act_temp; /* Auxiliary object used during configuration */ + struct grecs_list *act_list; /* ACLs for control interface */ pies_acl_t list_acl; /* List access control list */ pies_acl_t adm_acl; /* Administrative ACL (stop, start, etc.) */ @@ -262,6 +268,7 @@ enum pies_action { ACTION_CONT, ACTION_STOP, ACTION_RESTART, + ACTION_RELOAD, ACTION_CTRLALTDEL, ACTION_KBREQUEST }; @@ -289,7 +296,7 @@ extern size_t pies_master_argc; extern char **pies_master_argv; extern char *default_control_url[2]; -enum config_syntax +enum config_syntax_type { CONF_PIES, CONF_META1, @@ -297,12 +304,16 @@ enum config_syntax CONF_INITTAB }; -int str_to_config_syntax (const char *str, enum config_syntax *psynt); -void add_config (enum config_syntax syntax, const char *name); +struct config_syntax; + +struct config_syntax *str_to_config_syntax (const char *str); +void config_file_add (struct config_syntax *syntax, const char *name); +void config_file_add_type (enum config_syntax_type syntax, const char *name); void free_redirector (struct redirector *rp); void pies_schedule_action (int act); +void free_action (struct action *act); void register_prog (struct component *comp); int progman_running_p (void); @@ -313,11 +324,10 @@ void progman_stop (void); void progman_cleanup (int expect_term); void progman_filter (int (*filter) (struct component *, void *data), void *data); +int progman_wait_until (int (*cond) (void *), void *data); void progman_stop_tag (const char *name); -void progman_dump_prereq (void); -void progman_dump_depmap (void); int progman_accept (int socket, void *data); -int progman_build_depmap (void); + void progman_create_sockets (void); struct component *progman_lookup_component (const char *tag); struct component *progman_lookup_tcpmux (const char *service, @@ -351,6 +361,11 @@ pies_depmap_t depmap_alloc (size_t count); pies_depmap_t depmap_copy (pies_depmap_t dpm); void depmap_set (pies_depmap_t dmap, size_t row, size_t col); int depmap_isset (pies_depmap_t dmap, size_t row, size_t col); +void depmap_clear (pies_depmap_t dmap, size_t row, size_t col); + +void depmap_clear_all (pies_depmap_t dmap, enum pies_depmap_direction dir, + size_t coord); + void depmap_tc (pies_depmap_t dmap); size_t depmap_first (pies_depmap_t dmap, enum pies_depmap_direction dir, size_t coord, pies_depmap_pos_t *ppos); @@ -365,10 +380,25 @@ int socket_type_to_str (int socket_type, const char **pres); struct component *component_create (const char *name); void component_free (struct component *comp); +void component_ref_incr (struct component *comp); +void component_ref_decr (struct component *comp); + +void component_config_begin (void); +void component_config_rollback (void); +void component_config_commit (void); + +int component_is_active (struct component *comp); void component_finish (struct component *comp, grecs_locus_t *locus); struct grecs_keyword *find_component_keyword (const char *ident); +void components_dump_depmap (void); +void components_trace (char **argv, enum pies_depmap_direction dir); + +struct component *component_depmap_first (enum pies_depmap_direction dir, + size_t idx, pies_depmap_pos_t *ppos); +struct component *component_depmap_next (pies_depmap_pos_t pos); + void pies_pause (void); @@ -401,6 +431,7 @@ void enable_socket (int fd); int parse_limits (limits_record_t *plrec, char *str, char **endp); int set_limits (const char *name, limits_record_t lrec); void free_limits (limits_record_t rec); +int limits_cmp (limits_record_t a, limits_record_t b); void meta1_parser_set_debug (void); @@ -451,9 +482,13 @@ int switch_to_privs (uid_t uid, gid_t gid, struct grecs_list *retain_groups); void pies_priv_setup (struct pies_privs *); void pies_epriv_setup (struct pies_privs *); + +int pies_privs_cmp (struct pies_privs const *a, struct pies_privs const *b); +void pies_privs_free (struct pies_privs *p); + /* inetd.c */ -int inetd_parse_conf (const char *file); +int inetd_config_parse (const char *file); /* inetd-bi.c */ struct inetd_builtin |