import cinit from unix.schottelius.org

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
This commit is contained in:
Nico Schottelius 2009-09-16 12:53:45 +02:00
commit 423ba10303
13396 changed files with 269468 additions and 0 deletions

View file

@ -0,0 +1,20 @@
All abstracted communication functions. Do not depend on the underlying
inter process communication mechanism.
- send_command(): client function: sends a command to cinit
- send_service(): client function: send the service name to operate on
- read_command(): server function: reads beginning of a command
* Extracts the command
* reads client identification (=pid)
* calls other functions, depending on the command send => switch()
- read_service(): server function: reads service
- write_answer(): server function: answer?
* sends answers to clients => senseful?
TODO:
- define information function, that returns various information about
a service

View file

@ -0,0 +1,56 @@
/***********************************************************************
*
* 2007 Nico Schottelius (nico-cinit at schottelius.org)
*
* part of cLinux/cinit
*
* cinit reads a command sent by a client, called by ipc listener
*
*/
#include "comm.h" /* message struct definition */
#include "reboot.h" /* reboot abstraction layer */
int read_command(struct s_cmd cmd)
{
switch(cmd.cmd) {
case CMD_SVC_START:
break;
case CMD_SVC_START_ONLY:
break;
case CMD_SVC_START_NEEDS:
break;
case CMD_SVC_STOP:
break;
case CMD_SVC_STOP_ONLY:
break;
case CMD_SVC_STOP_WANTS
break;
/* halt/shutdown/poweroff */
case CMD_HALT:
cinit_do_halt();
break;
case CMD_REBOOT:
cinit_do_halt();
break;
case CMD_POWEROFF:
cinit_do_poweroff();
break;
/* return error to client */
default:
break;
}
return 1;
}

View file

@ -0,0 +1,15 @@
/***********************************************************************
*
* 2007 Nico Schottelius (nico-cinit at schottelius.org)
*
* part of cLinux/cinit
*
* A client sends a command to cinit
*/
#include "comm.h" /* message struct definition */
send_command(struct s_cmd cmd)
{
/* cinit_ipc_to_server() */
}