add cinit-0.3pre15

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
This commit is contained in:
Nico Schottelius 2009-09-23 08:01:33 +02:00
commit 440caeb555
1013 changed files with 99995 additions and 0 deletions

View file

@ -0,0 +1,305 @@
# Doxyfile 1.5.6
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = cinit
PROJECT_NUMBER = 0.3pre15
OUTPUT_DIRECTORY = /home/user/nico/oeffentlich/computer/projekte/cinit/doxygen
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = /home/user/nico/oeffentlich/computer/projekte/cinit/cinit/src
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 3
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
TYPEDEF_HIDES_STRUCT = NO
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = /home/user/nico/oeffentlich/computer/projekte/cinit/cinit/src
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.c \
*.cc \
*.cxx \
*.cpp \
*.c++ \
*.d \
*.java \
*.ii \
*.ixx \
*.ipp \
*.i++ \
*.inl \
*.h \
*.hh \
*.hxx \
*.hpp \
*.h++ \
*.idl \
*.odl \
*.cs \
*.php \
*.php3 \
*.inc \
*.m \
*.mm \
*.dox \
*.py \
*.f90 \
*.f \
*.vhd \
*.vhdl \
*.C \
*.CC \
*.C++ \
*.II \
*.I++ \
*.H \
*.HH \
*.H++ \
*.CS \
*.PHP \
*.PHP3 \
*.M \
*.MM \
*.PY \
*.F90 \
*.F \
*.VHD \
*.VHDL
RECURSIVE = YES
EXCLUDE = /home/user/nico/oeffentlich/computer/projekte/cinit/cinit/src/ancient/ \
/home/user/nico/oeffentlich/computer/projekte/cinit/cinit/src/test/
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
HTML_DYNAMIC_SECTIONS = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NONE
TREEVIEW_WIDTH = 250
FORMULA_FONTSIZE = 10
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = YES
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = YES
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
DOT_FONTNAME = FreeSans
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = YES
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

View file

@ -0,0 +1,18 @@
cinit/doc/devel
===============
Nico Schottelius <nico-linux-cinit__@__schottelius.org>
0.1, Initial Version from 2006-07-09
:Author Initials: NS
This directory contains cinit development documents.
Introduction
------------
This file describes the related documents in the current directory.
Who should read those documents?
--------------------------------
(cinit-)developers.
Content
-------

View file

@ -0,0 +1,115 @@
cinit 0.4 - Redesign of cinit
============================================
Nico Schottelius <nico-linux-cinit__@__schottelius.org>
0.4.0, for cinit 0.4, Initial Version from 2006-03-11
:Author Initials: NS
cinit 0.2 ran fine and the general project of developing a
parallel executing init system is finished.
With cinit 0.4 there are new aims to reach.
Introduction
------------
. AIMS
- portability: no Linux-dependency anymore
- cleaner signal handling
- better documentation so more people can use it
Current problems
----------------
Temporary filesystem and socket problematic
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The mount(2) system call is os-specific.
The temporary fs is os-specific.
Signal handlers are not clean
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Race conditions when multiple signals arrive
Reboot code is os specific
~~~~~~~~~~~~~~~~~~~~~~~~~~
serv/sig_reboot.c contains umount, remount hard coded.
Solutions
---------
Temporary filesystem and socket problematic
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Remove
- the mount call
- do not create an initial socket
Wait until we recieve a signal, then we create a socket
under the configured socket directory (see `conf/sockdir`).
Signal handlers are not clean
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reboot code is os specific
~~~~~~~~~~~~~~~~~~~~~~~~~~
Misc
~~~~
- Configuration
/etc/cinit/config/
init -> link to initial service
pre_boot
pre_boot_args
post_boot
post_boot_args
/etc/cinit/services/
/etc/cinit/profiles/
links to the starting services
cinit - Internals
=================
Nico Schottelius <nico-cinit__@__schottelius.org>
0.1 for cinit-0.3, Initial version: So Feb 19 10:25:46 CET 2006
:Author Initials: NS
Introduction
------------
This document describes the internals of cinit. It is thought
to be read by developers.
Child handler code in cinit-0.3
-------------------------------
In cinit versions <= cinit-0.2.1 the respawning services where
handled by an extra child handler, which was a fork of cinit. This
had some problems:
- We allocated more memory than necessary, unecessary parts of
cinit were copied
- The SIG_CHILD-handler was not written very clean, in some versions
it was completly missing.
. So in `cinit-0.3` we changed it the following way:
- no extra child handlers
- handle everything in the SIG_CHILD handling function
- when sig_child is recieved do:
- check against respawn list
- if it is a respawning service, [do the following in a seperate fork?]
check whether it successfully stoped
- if yes: restart immediatly
- if no: sleep $sleep_time and then restart

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View file

@ -0,0 +1,149 @@
Coding style
============
Nico Schottelius <nico-cinit]at[schottelius.org>
0.1, for cinit, Initial version from 2006-11-13
:Author Initials: NS
This document describes the coding style used in cinit.
Indent
------
Indent the code by 3 spaces for each level.
Indent variable names, so the names begin all at the same position.
Use three spaces to place them.
Whitespaces
-----------
Where to put or avoid whitespaces (space or linefeed (lf)).
Spaces
~~~~~~
- After closing brace "if(test) return 0;"
- Spaces before and after '=', '>', '<', '==', '!='', '>=', '<=', '>>', '<<', '&', '&&', '|', '||'
- After start of comment and before end of comment: '/* text */'
After ')', ','
No spaces
~~~~~~~~~
- Within braces and code "(!test)",
- Before braces "if(code)"
- No space before ), so if '))', do not put a space after the first ')'
Linebreaks
~~~~~~~~~~
This somehow includes the setting of braces (indirectly through (not) setting
spaces.
If
^^
Put the if, the braces and the opening curly brace on one line,
put the closing one together with `else` and the new opening
curly brace on one line:
------------------------------------------------------------------------------
if(...) {
/* code */
} else {
/* else: code */
}
------------------------------------------------------------------------------
While
^^^^^
------------------------------------------------------------------------------
while(condition) {
/* repeat */
}
------------------------------------------------------------------------------
Do-While
^^^^^^^^
------------------------------------------------------------------------------
do {
/* something */
} while(running);
------------------------------------------------------------------------------
Switch
^^^^^^
------------------------------------------------------------------------------
switch(value) {
case DO_SOMETHING:
/* code */
break;
default:
break;
}
------------------------------------------------------------------------------
Where to put curly braces
-------------------------
Functions
~~~~~~~~~
Opening and closing curly braces are placed on a seperate row:
------------------------------------------------------------------------------
int func(int params)
{
body
}
------------------------------------------------------------------------------
If, else, while, do-while
~~~~~~~~~~~~~~~~~~~~~~~~~
See above.
Comments
---------
where necessery, do not state the obvious in comments:
/* this code increments tmp */
++tmp;
If there is more than one line containing a comment, try to adjust them
so they look the same in width and position:
------------------------------------------------------------------------------
int illuminati = 23; /* do not want to comment that */
int the_answer_to_everything = 42; /* 42. */
[...]
while(illuminati < the_answer_to_everything) { /* only try before them */
overtake_world(&self); /* overtake is complex */
}
------------------------------------------------------------------------------
Header
-------
Put a header into each file, containing:
- Date of file being put into existence (year is enough)
- Name and e-mail (obfuscated if you want) of the author(s)
- Description of the function
- Copyright statement (if not included GPLv2 or later is assumed)
Includes
~~~~~~~~
Include system headers first, then place own headers. Comment the includes,
wherefore you added them. Example:
------------------------------------------------------------------------------
#include <unistd.h> /* write */
#include "cinit.h> /* cinit_ipc_* */
------------------------------------------------------------------------------

View file

@ -0,0 +1,248 @@
cinit - communication
=====================
Nico Schottelius <nico-linux-cinit__@__schottelius.org>
0.1 for cinit-0.3, Initial version: 2006-08-11
:Author Initials: NS
This document describes the internal communication of cinit.
It is thought to be read by developers.
Introduction
------------
This document describes the messages used between cinit, cinit forks
and other programs that want to talk to cinit. It does NOT
describe the communication method, but only the messages sent
(for the communication method read "ipc.text").
Document status
~~~~~~~~~~~~~~~
This document is still being written, it is not finished.
About Messages
--------------
Order
~~~~~
The client always initiates the communication.
cinit will begin listening to messages directly after its start.
Numbers
~~~~~~~
Can be found in include/cinit.h.
Data
~~~~~
A message always conists of a predefined structure (see src/headers/comm.h).
Can't use a structure, were missing the point that we cannot transfer dynamic
length strings. Thus the protocol consists of:
client(int) => cinit
cinit(ini) => client
=> after that follows command specific data
The byte order is host specific (may be little or big endian).
STRUCTURE WITH STATIC SIZE. MSGRCV!
IPC LAYER CREATES TRANSPORT!
Type
~~~~
Messages are binary data.
The messages
------------
The client always uses the same structure (struct msg_client) to contact
cinit. This way cinit does not need to handle dynamic data structures.
cinit in contrast delivers different data structures to its clients,
depending on the question.
The questions are issued by any type of client, the internal command used is
noted in square brackets ([]).
The answers are given by cinit.
Question: Start a service (and its dependencies) [CMD_START_SVC]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This command is issued either by a cinit fork or by an external client.
cinit will start a fork, which tries to start the service and its dependencies.
The client must provide cinit with the following information:
. Name of the service to be started
. Reason why to start it
. eventually additional information (see below)
The reason
^^^^^^^^^^
Can be one of:
- RS_NONE (it's a manual start request)
- RS_WANTS (a currently starting service wants to start this service)
- RS_NEEDS (a currently starting service needs to start this service)
If the reason is RS_WANTS or RS_NEEDS the client must supply the name
of the service, which wants it to be started.
Question: Start a service (nothing else) [CMD_START_SVC_ONLY]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This command may only be issued by an external client.
cinit will start a fork, which tries to start the service and which will
report the status back.
Question: Stop a service (and its dependencies) [CMD_STOP_SVC]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This command is issued either by a cinit fork or by an external client.
cinit will start a fork, which tries to stop the service and each service
that 'needs' it.
This function works recursively, thus also killing those services, that
need the service that need the current service.
Question: Stop a service (nothing else) [CMD_STOP_SVC_ONLY]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This command may only be issued by an external client.
cinit will start a fork, which tries to stop this service and which will
report the status back.
Question: Stop a service (plus 'needs' and 'wants') [CMD_STOP_SVC_WANTS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Same as 'Stop a service (and its dependencies)', but also stop the
services that want to have this service.
This function works recursively, thus also killing those services, that
'need' or 'want' the service that 'need' or 'want' the current service.
Question: What's the status of service XYZ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Code, length of service name, the service name (without \0).
int, int, char[];
Question: Could you change the status? [CMD_CHG_STAT]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A cinit fork reports the new status of a service.
Question: Could you start the rescue mode? [CMD_RESCUE]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This command may only be issued by an external client.
cinit will not give an answer to this question.
cinit will stop all services, kill all other processes and after that
spawn the rescue program.
Question: Could you halt the system? [CMD_HALT]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This command may only be issued by an external client.
cinit will not give an answer to this question.
cinit will stop all services, kill all other processes and after that
halt the system.
Question: Could you reboot the system? [CMD_REBOOT]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This command may only be issued by an external client.
cinit will not give an answer to this question.
cinit will stop all services, kill all other processes and after that
reboot the system.
Question: Could you poweroff the system? [CMD_POWEROFF]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This command may only be issued by an external client.
cinit will not give an answer to this question.
cinit will stop all services, kill all other processes and after that
poweroff the system. If poweroff is not possible, the system will
be halted.
Question: Could you warmboot the system? [CMD_WBOOT]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This command may only be issued by an external client.
cinit will not give an answer to this question.
cinit will stop all services, kill all other processes and after that
restart itself and the bootup process.
Question: Could you send information about a service? [CMD_INFO]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This command may only be issued by an external client.
cinit will respond with detailled information about the service
to the client.
Answer: Return short status of a service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This answer is used as a response to:
- Question: Start a service (and its dependencies)
- Question: Start a service (nothing else)
- Question: Stop a service (and its dependencies)
- Question: Stop a service (nothing else)
- Question: Stop a service (plus 'needs' and 'wants')
- Question: Could you change the status?
cinit only responds the status of the asked service.
The structure send is "asw_sstatus", which only include a status byte.
Answer: Return long status of a service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This answer is used as a response to:
- Question: Could you send information about a service?
old Messages (to be transferred into this document)
---------------------------------------------------
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.
CMD_RESCUE: Kill everything, and spawn a sulogin shell.
CMD_UPDATE: Hot-reboot system and reload cinit.
CMD_HALT: Halt the system
CMD_REBOOT: Reboot the system
CMD_POWEROFF: Power-off the system
--------------------------------------------------------------------------------
Service status:
--------------------------------------------------------------------------------
service status (cinit),
Nico Schottelius 2005-09-29 (Last Modified: -)
--------------------------------------------------------------------------------
There are service status and service returns. Service status is a status
a service can have. A service return is a value from a function that
describes what happened with the service.
Status has ST_ prefix, return has RT_ prefix.
See cinit.h for most up to date versions.
ST_NEED_FAIL - this service will not be started, until the needs are started
ST_FAIL - this service failed to start
ST_UNSPEC - some unknown error. This should never happen.
ST_ERR - ??? /* tried earlier, service failed, won't retry */
ST_SUCCESS - service was successfully started - senseful?
ST_TMP - some instance is currently working on it
ST_ONCE - executed once sucessfully
ST_RESPAWN - service is running and respawning
ST_TMPNOW 55 /* now you are on it - only for clients */
#define ST_OFF 56 /* Switching service off */

View file

@ -0,0 +1,18 @@
cinit/doc/devel/using-conf.text
================================
Nico Schottelius <nico-linux-cinit__@__schottelius.org>
0.1, Initial Version from 2006-07-28
:Author Initials: NS
About conf/* and how to use the configurations.
Introduction
------------
Who should read those documents?
--------------------------------
Content
-------

View file

@ -0,0 +1,36 @@
TODO:
- merge into "Cross compiling"
cinit - Problems that may arise
===============================
Nico Schottelius <nico-linux-cinit__@__schottelius.org>
0.1, for cinit 0.3, Initial Version from 2006-06-03
:Author Initials: NS
Max open files
OS dependent
Installing cinit
Introduction
------------
General sections, OS-specific, ...
Installing
----------
From source
~~~~~~~~~~~
In General
^^^^^^^^^^
Download, edit conf/os to the os
Cross-compiling
^^^^^^^^^^^^^^^
conf/os to destination os
conf/cc
conf/ld
conf/cflags
conf/ldflags

View file

@ -0,0 +1,169 @@
IPC - in cinit and in general
=============================
Nico Schottelius <nico-linux-cinit__@__schottelius.org>
0.1, Initial Version from 2006-07-09
:Author Initials: NS
IPC - Inter process communication
Introduction
------------
This document describes the IPC methods used and/or tested for
cinit.
It does not describe in detail, how the different methods work
(this is already done many times, there's great documentation
available online), but more the advantages and disadvantages
(especially for an init system).
What is IPC?
~~~~~~~~~~~~
IPC describes methods to communicate between different processes
(programs).
IPC as described by SUSV3 (The Single UNIX Specification Version 3)
aka IEEE Std 1003.1, 2004 Edition aka POSIX only defines
MSQ, SHM and Semaphores as IPC. This document also covers
Sockets and FIFOs.
What is not (yet) covered by this document?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Speed of different IPC methods, different behaviour on different
unices.
Why do you need IPC for an init system?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cinit IPC history + analysis
----------------------------
FIFOs
~~~~~
First in - first out
File on the filesystem
Always need two files for two way communication
Hints
^^^^^
The first idea for IPC in cinit was to use two FIFOs, like minit does.
Wrong assumption:
runit also uses fifos, but two fifos for each services. That way
more parallel transmissions is possible.
You have to pay attention: Maximum number of opened files!
(On Linux 2.6 this is 1024, which makes a maximum of 512 services.
This limit is most likely never reached, but you have to keep it
in mind).
Sockets
~~~~~~~
Clean and beautiful. They allow easy two way communication.
If you created a socket, fs is r/o, you cannot use it, although
there is SO_REUSE.
First method: Using memory mapped part (tmpfs).
Second method: use interal communication (pipes!) and external after
/etc/cinit/ becomes writable.
Current IPC configuration
--------------------------
- switchable (conf/ipc_method)
- each ipc implementation needs:
ipc.h -> for global variables and ipc specific things
prefix variables with ipc_
int cinit_ipc_init(void); -> general initialization
return 1 on success, 0 on failure
int cinit_ipc_listen(void); -> begin to listen for messages
int cinit_ipc_send(void *data) -> send data to a client
Abstraction layer: cinit_ipc_*
------------------------------
You can choose or even reimplement ipc code for cinit. You only have to create
a directory below src/ipc/ and create the following necessary functions:
int cinit_ipc_init(void);
~~~~~~~~~~~~~~~~~~~~~~~~~
Initialise the IPC functions in cinit.
int cinit_ipc_listen(void);
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Never ending looping function that listens for commands and passes the
retrieved command to read_command().
other
~~~~~~
int cinit_ipc_sclose(void); /* fork of cinit come from outside! */
int cinit_ipc_ssend(void *data); /* send to a client from the server */
void cinit_ipc_destroy(void); /* destroy ipc handler in cinit */
cinit_get_data(int ident, int size, void *data) => read size bytes from client
with ident
/*****************************************************************************
* Functions: in clients
*/
int cinit_ipc_logon(void); /* logon to init (client init) */
int cinit_ipc_connect(void); /* connect to init */
int cinit_ipc_csend(struct cinit_message *data); /* send to the server from a client */
--------------------------------------------------------------------------------
Messages:
struct cinit_question qsn;
struct cinit_answer asr;
question:
answer:
int cinit_send_to(struct cinit_question *data, struct cinit_answer *res)
-> return 0 on ipc errors
--------------------------------------------------------------------------------
enable / disable services:
- send svc
- send flags
- recv return:
CINIT_ASW_SVC_STOPPED: successfully stopped the service
CINIT_ASW_SVC_ERR: failed to stop the service
CINIT_ASW_SVC_WANTS: wants failed
CINIT_ASW_SVC_NEEDS: needs failed
opt contains number of failed services
retriev them from cinit after that
--------------------------------------------------------------------------------
TO SORT:
1. message queues
o clients schreiben rein
o datenpaket gross genug fuer antwort?
2. shared memory
o client kann direkt rauslesen, was gestartet werden muss
o client kann direkt abhaengigkeiten starten, muss diese aber
eintragen
Ausprobieren:
- Mutexe
- Message Queues
-
Ideen:
Message queue
1. Client geht auf die normale
als id = pid (cast!)
dann rueck via anderer queue

View file

@ -0,0 +1,22 @@
Lists in cinit-0.3 are generalized, all have the same general layout:
- double linked
- have 'prev' and 'next' as pointers
Add an element to a list
/--------------------------\
|<->first<->middle<->last<->|
After insert:
/-------------------------------\
|<->first<->middle<->last<->new<->|
We alway have 'first'.
Need to adjust:
- new->prev = last (= first->next)
- new->next = first
- first->prev = new
- first->prev->next (= last->next) = new

View file

@ -0,0 +1,68 @@
TODO:
- rewrite to asciidoc
- implement a sample merge
--------------------------------------------------------------------------------
Merging other init systems to cinit,
Nico Schottelius, 2005-06-02 (Last Modified: 2005-06-11)
--------------------------------------------------------------------------------
1. Preamble
2. General to do
3. Create a script
1. Preamble
There is no tool available to merge any existing init-system-configuration
to cinit style. This is not because the author of cinit does not
care about support for that. He simply he has
a) no access to every init-system available
b) not the time to analyze every init system
He instead spends the time to improve and bugfix cinit.
This does not mean that he does not accepts scripts, which do the work.
In fact, creating and submitting a merge tool is much appreciated!
2. General to do
1. Choose your target init and possibly target platform:
- sysvinit may be different on AIX, SuSE and Debian
- /etc/rc may look different on each *BSD
- Sometimes even same platforms differ in versions:
SuSE 5.1 uses a different configuration then SuSE 9.0
So decide whether you want and can write a general merge tool
or if you have to specialize.
After deciding, name the script you want to write with the following
syntax:
cinit-merge.$init-$platform-$version
$platform and $version (either both or only platform) can be omitted.
Examples:
cinit-merge.sysvinit-debian-3.0
cinit-merge.minit
2. Analyze how it works, detect the mechanism in it
Your script has to detect if dependencies exist and resolve
them. It has to take care of special configurations and possibly
warn the user.
3. Create a script
Now, after you learned how the old init system works, you can start creating
the merge-script (naming see above).
This merge script
a) will perhaps not cover full old system (if so, warnings should be printed
b) should try to avoid using old (shell)-scripts, as starting
a shell for every service needed makes starting up slow
c) will include some basic features, that are needed everytime on this
platform (setting kernel configuration, hostname, etc)

View file

@ -0,0 +1,33 @@
--------------------------------------------------------------------------------
optimising cinit,
Nico Schottelius, 2005-06-09 (Last Modified: -)
--------------------------------------------------------------------------------
0. Warning
1. gcc options
2. striping
0. Warning
Any optimisation may cause cinit (not just cinit, but any program) to fail
and to do mysterious things instead of expected actions.
1. gcc options
gcc knows of several optimisation flags. Mostly interesting is -Os for small
size (this is btw broken on gcc-3.4.3 on x86!).
One can also pass -Werror so that any warning makes the compile to fail.
The current standard for cinit is: (see CFLAGS in the Makefile).
2. striping
With strip(1) you can remove specific sections of object files.
You have to find out, which ones you can remove safely
(for instance with objdump(1)).
The current standard for cinit is: (see STRIP in the Makefile)

View file

@ -0,0 +1,11 @@
m = manually
a = automated
m Install OS of your choice into KVM, including make, gcc, ssh and rsync
m Startup VM
a Transfer data to VM
a Compile cinit on VM
a Install cinit and configuration on VM
m Configure bootloader to add cinit as alternative choice
m Reboot and start cinit

View file

@ -0,0 +1,48 @@
--------------------------------------------------------------------------------
testing cinit in a User-Mode-Linux (uml),
Nico Schottelius 2005-06-14 (Last Modified: 2005-06-14)
--------------------------------------------------------------------------------
1. Get an image you want to install cinit to
2. Compile an UML
3. change bin/cinit.uml.test to your needs
4. put a configuration (/etc/cinit) on to your image
5. ./bin/cinit.uml.test
-> wait, your Linux starts with cinit enabled.
If you omit 4, you'll see how cinit will fail without having its base
directory.
--------------------------------------------------------------------------------
Using a raw (x86) hd image:
Access partition 1 via losetup:
sudo losetup -o 32256 /dev/loop0 "$hierabs/debian-hd.img"
linux ubd0=/dev/loop0 init=/sbin/cinit "$@"
Offset was taken from fdisk:
[19:22] denkbrett:emu# fdisk -l -u /dev/sda
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x1669c708
Device Boot Start End Blocks Id System
/dev/sda1 63 19535039 9767488+ 83 Linux
/dev/sda2 19535040 23438834 1951897+ 82 Linux swap / Solaris
/dev/sda3 23438835 156296384 66428775 83 Linux
===> 63*512bytes spaeter beginnt sda1
[19:23] denkbrett:~% echo 512\*63 |bc -l
32256
Results in losetup -o 32256 /dev/loop0 ./debian-hd.img
Scripts from the nsbin project (lo-*) can be used.
It can be found at http://unix.schottelius.org/cgi-bin/gitweb.cgi.
--------------------------------------------------------------------------------