423ba10303
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
89 lines
3.5 KiB
Text
89 lines
3.5 KiB
Text
--------------------------------------------------------------------------------
|
|
cinit commands, Nico Schottelius 2005-04-28
|
|
--------------------------------------------------------------------------------
|
|
|
|
cinit allows communication through a socket (see ipc.thoughs for reasons).
|
|
|
|
Sockets allow to find out the accessing uid, gid and pid (uses SO_PEERCRED as
|
|
socketoption).
|
|
|
|
The communication-protocol is binary.
|
|
|
|
--------------------------------------------------------------------------------
|
|
Protocol overview
|
|
--------------------------------------------------------------------------------
|
|
|
|
Any communication begins with a command. A command is a one byte
|
|
unsigned char. Depending on the command, the communication has its own
|
|
semantics.
|
|
|
|
|
|
Commands are: (values can be found in cinit.h)
|
|
|
|
CMD_START_SVC: I want to start a service.
|
|
CMD_CHG_STATUS: I want to change the status of a service.
|
|
CMD_STOP_SVC: Please shutdown a service and its dependencies.
|
|
CMD_KILL_SVC: Shutdown a service, don't care about its dependencies.
|
|
|
|
CMD_RESCUE: Kill everything, and spawn a sulogin shell.
|
|
CMD_INIT: Start all services (again possibly).
|
|
|
|
CMD_HALT: Halt the system*)
|
|
CMD_REBOOT: Reboot the system*)
|
|
CMD_POWEROFF: Power-off the system*)
|
|
|
|
*) The commands are not and maybe will never be implemented,
|
|
as they are realized as signals.
|
|
|
|
--------------------------------------------------------------------------------
|
|
Detailled command-listing
|
|
--------------------------------------------------------------------------------
|
|
|
|
CMD_START_SVC
|
|
1. int len; /* length of service name, including \0 */
|
|
2. char *svc; /* name of the service, absolute pathname */
|
|
|
|
cinit returns:
|
|
a) ok, a SID, a service ID: int svc_id; [ really need int? ]
|
|
b) fail, [currently only fail is returned]
|
|
a) already running
|
|
b) svc_name too long / not allowed
|
|
|
|
[ A service identification is used for faster searching in cinit.
|
|
It is also a hint for developers of external software, that they should not
|
|
be able to use CMD_CHG_STATUS, if they didn't start a service.
|
|
They should use CMD_STOP_SVC to stop a service.
|
|
Starting a service is currently done via exec() in the external program or
|
|
a cinit-fork(). ]
|
|
|
|
CMD1CHG_STATUS: I want to change the status of a service.
|
|
0. int len;
|
|
1. char *svc;
|
|
2. char status; /* status:
|
|
once: started successfully the service once.
|
|
fail: tried to start once, but the service exit ungracefully
|
|
respawn: I am on it, as soon it exists I'll restart! */
|
|
2. pid_t pid /* the pid of the service, if started once
|
|
or the pid of the service watcher, if respawning */
|
|
|
|
cinit returns: MSG_OK|MSG_FAIL (char)
|
|
|
|
CMD_STOP_SVC: Please shutdown a service and its dependencies.
|
|
1. int len; /* length of service name, including \0 */
|
|
2. char *svc; /* name of the service, absolute pathname */
|
|
|
|
cinit returns: ready...
|
|
|
|
CMD_KILL_SVC: Shutdown a service, don't care about its dependencies.
|
|
1. int len; /* length of service name, including \0 */
|
|
2. char *svc; /* name of the service, absolute pathname */
|
|
|
|
cinit returns: ready...
|
|
|
|
CMD_INIT: Start all services (again possibly).
|
|
cinit returns: ready...
|
|
|
|
CMD_RESCUE: Kill everything, and spawn a sulogin shell.
|
|
CMD_HALT: Halt the system.
|
|
CMD_REBOOT: Reboot the system.
|
|
CMD_POWEROFF: Power-off the system.
|