aboutsummaryrefslogtreecommitdiff
path: root/src/pies.h
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2012-12-30 15:36:56 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2013-01-04 12:29:27 +0200
commitcf14c349fad774e477a80d1c5e6572f21f17ced1 (patch)
treed8d73b072902cadc5aea5583119ec9e4e8ced2bc /src/pies.h
parent64c343ff8f11c8379ec21916ba915a2894495797 (diff)
downloadpies-cf14c349fad774e477a80d1c5e6572f21f17ced1.tar.gz
pies-cf14c349fad774e477a80d1c5e6572f21f17ced1.tar.bz2
Initial support for running as init process.
* grecs: Upgrade. * lib/Makefile.am: Use AM_CPPFLAGS instead of INCLUDES. * src/Makefile.am: Likewise. * src/acl.c: Update grecs_keyword definitions. * src/inetd.c (inetd_conf_file): Bugfix. The ws structure could be free'd prior to initialization. * src/pies.c: Update grecs_keyword definitions. (init_process,initdefault,dfl_level): New globals. (modetab) <once>: New keyword. (component_keywords)<runlevels,initdefault>: New keywords. (main): Initial support for init(8) mode. * src/pies.h (pies_comp_mode) <pies_comp_exec_once>: New constant. (component)<runlevels>: New member. (init_process,console_device,initdefault): New externs. * src/progman.c (prog_status)<status_finished>: New status. (prog)<runlevels>: New member. (progman_running_p): New function. (prog_start): Special handling for init process mode. (progman_start): Likewise. Take into account runlevels. (progman_dump_stats): New flag 'f' for status_finished.
Diffstat (limited to 'src/pies.h')
-rw-r--r--src/pies.h53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/pies.h b/src/pies.h
index 73b0583..9b3ae9d 100644
--- a/src/pies.h
+++ b/src/pies.h
@@ -122,6 +122,9 @@ struct pies_privs
enum pies_comp_mode
{
+ /*
+ ** Pies native component types.
+ */
/* Execute the component, no sockets are opened. This is the default
Pies mode. */
pies_comp_exec,
@@ -137,7 +140,47 @@ enum pies_comp_mode
/* Open a socket, start a component, and pass the socket fd to the
component via the UNIX domain socket. Corresponds to
`start_action = pass' in MeTA1. */
- pies_comp_pass_fd
+ pies_comp_pass_fd,
+
+ /*
+ ** Init-style components
+ */
+
+ /* Start the process when the specified runlevel is entered and wait
+ for its termination */
+ pies_comp_wait,
+ /* Execute the component once, when the specified runlevel is entered */
+ pies_comp_once,
+ /* Execute the component during system boot. Ignore runlevel settings. */
+ pies_comp_boot,
+ /* Execute the component during system boot and wait for it to terminate.
+ Ignore runlevel settings. */
+ pies_comp_bootwait,
+ /* Execute the component when the power goes down. */
+ pies_comp_powerfail,
+ /* Execute the component when the power goes down. Wait for it to
+ terminate. */
+ pies_comp_powerwait,
+ /* Execute the component when the power is restored. Wait for it to
+ terminate. */
+ pies_comp_powerokwait,
+ /* Execute the process when SIGINT is delivered, i.e. someone has
+ pressed the Ctrl+Alt+Del combination. */
+ pies_comp_ctrlaltdel,
+ /* Execute the component when a specified ondemand runlevel is called */
+ pies_comp_ondemand,
+ /* Execute the component on the system boot. */
+ pies_comp_sysinit,
+ /* Execute the component when running on the UPS and pies is informed that
+ the UPS battery is almost empty. */
+ pies_comp_powerfailnow,
+ /* Execute the component a signal from the keyboard handler arrives,
+ indicating that a special key combination was pressed on the console
+ keyboard. */
+ pies_comp_kbrequest,
+
+ /* Restart the component wherever it terminates */
+ pies_comp_respawn = pies_comp_exec,
};
#define CF_DISABLED 0x001 /* The componenet is disabled */
@@ -176,6 +219,9 @@ struct component
mode_t umask; /* Umask to install before starting */
limits_record_t limits; /* System limits */
+ /* For exec (init) components */
+ char *runlevels;
+
/* For inetd components */
size_t max_rate; /* Maximum number of invocations per minute */
size_t max_ip_connections; /* Max. number of connections per IP address */
@@ -225,7 +271,12 @@ extern char **mailer_argv;
extern size_t default_max_rate;
extern char *qotdfile;
+extern int init_process;
+extern char *console_device;
+extern int initdefault;
+
void register_prog (struct component *comp);
+int progman_running_p (void);
size_t progman_running_count (void);
void progman_start (void);
void progman_wake_sleeping (int);

Return to:

Send suggestions and report system problems to the System administrator.