path: root/src/pies.h
diff options
authorSergey Poznyakoff <gray@gnu.org.ua>2013-01-06 17:04:28 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2013-01-06 17:04:28 +0200
commit1bfa33ac7c167cd863b88a5cac7690d511851e6e (patch)
treea892e281cba3ea127af5faf5da81ff2cc0c3aae9 /src/pies.h
parent4f7c28158308563dcad912d87a0031d095d4690a (diff)
Fix runlevel transition algorithm, implement SysV-style fifo interface.
* src/prog.h: New file. * src/Makefile.am: Add new file. * src/cmdline.opt: New option --telinit (-T). * src/diag.c (vlogmsg): In sysvin it mode, write directly to the console. Close it when finished. * src/pies.c (_cb_initdefault, _cb_runlevels): Use is_valid_runlevel to check if the specified runlevels are ok. (main): In sysvinit mode, reset action to ACTION_CONT. * src/pies.h (progman_filter): New proto. (progman_accept,register_socket): Change signature. (deregister_socket): New proto. (register_program_socket): New proto. * src/progman.c: Move constant and adatatype definitions to prog.h (prog_stop): Remove static qualifier. (console_open): Likewise. (progman_accept): Use new socket API. (progman_stop): Correctly handle timeouts. (progman_foreach): New function. * src/socket.c: Register all sockets along with their handlers in a doubly-linked list. (sockinst): New struct. (register_socket,deregister_socket): New functions. (register_program_socket): New function. (pies_pause): Traverse the list to find which fd has changed. Use its registered handler to handle the event. * src/sysvinit.c: Include prog.h (is_valid_runlevel): New function. (sysvinit_fifo_handler,check_fifo): New static functions. (inittrans): Fix transition algorithm. (telinit): New function.
Diffstat (limited to 'src/pies.h')
1 files changed, 34 insertions, 2 deletions
diff --git a/src/pies.h b/src/pies.h
index e7ad1c6..2203d87 100644
--- a/src/pies.h
+++ b/src/pies.h
@@ -285,11 +285,13 @@ void progman_start (void);
285void progman_wake_sleeping (int); 285void progman_wake_sleeping (int);
286void progman_stop (void); 286void progman_stop (void);
287void progman_cleanup (int expect_term); 287void progman_cleanup (int expect_term);
288void progman_filter (int (*filter) (struct component *, void *data),
289 void *data);
288void progman_stop_component (const char *name); 290void progman_stop_component (const char *name);
289void progman_dump_stats (const char *filename); 291void progman_dump_stats (const char *filename);
290void progman_dump_prereq (void); 292void progman_dump_prereq (void);
291void progman_dump_depmap (void); 293void progman_dump_depmap (void);
292int progman_accept (int socket); 294int progman_accept (int socket, void *data);
293int progman_build_depmap (void); 295int progman_build_depmap (void);
294void progman_create_sockets (void); 296void progman_create_sockets (void);
295struct component *progman_lookup_component (const char *tag); 297struct component *progman_lookup_component (const char *tag);
@@ -362,7 +364,10 @@ void pies_url_destroy (struct pies_url **purl);
362const char * pies_url_get_arg (struct pies_url *url, const char *argname); 364const char * pies_url_get_arg (struct pies_url *url, const char *argname);
363 365
364void pies_pause (void); 366void pies_pause (void);
365int register_socket (int socktype, int fd); 367void *register_socket (int fd, int (*handler) (int, void *), void *data);
368void deregister_socket (int fd);
370int register_program_socket (int socktype, int fd, void *data);
366int pass_fd (const char *socket, int fd, unsigned time_out); 371int pass_fd (const char *socket, int fd, unsigned time_out);
367int create_socket (struct pies_url *url, int socket_type, 372int create_socket (struct pies_url *url, int socket_type,
368 const char *user, mode_t umask); 373 const char *user, mode_t umask);
@@ -456,6 +461,33 @@ struct inetd_builtin *inetd_builtin_lookup (const char *service, int socktype);
456void sysvinit_begin (void); 461void sysvinit_begin (void);
457int inittrans (void); 462int inittrans (void);
458int is_comp_wait (struct component *comp); 463int is_comp_wait (struct component *comp);
464int is_valid_runlevel (int c);
466#ifndef INIT_FIFO
467# define INIT_FIFO "/dev/initctl"
470#define INIT_MAGIC 0x03091969
471#define INIT_CMD_START 0
472#define INIT_CMD_RUNLVL 1
475#define INIT_CMD_POWEROK 4
476#define INIT_CMD_BSD 5
477#define INIT_CMD_SETENV 6
478#define INIT_CMD_UNSETENV 7
480#define INIT_CMD_CHANGECONS 12345
482struct sysvinit_request {
483 int magic; /* Magic number */
484 int cmd; /* What kind of request */
485 int runlevel; /* Runlevel to change to */
486 int sleeptime; /* Time between TERM and KILL */
487 char pad[368];
459 491
460/* utmp.c */ 492/* utmp.c */
461#define SYSV_ACCT_BOOT 0 493#define SYSV_ACCT_BOOT 0

Return to:

Send suggestions and report system problems to the System administrator.