Add basic support to specify login TTYs in configuration

This also adds support for monitor /dev for TTYs appering after boot,
USB-to-serial converters for example.

Some limitations: Baudrate (and other settings) is hardcoded for now,
should be read from config file.
Add missing include <sys/stat.h>
libite: Add strlcat and strlcpy.

These function only exist on uClibc and BSD, so if they
not already defined in string.h, define them here.
Merge pull request #1 from mattiaswal/tty

Add basic support to specify TTYs in configuration
Merge pull request #2 from mattiaswal/eglibc

Add support for strlcpy and strlcat
TODO: Update with requests for more consoles and runlevel support
Makefile: Minor cleanup and only set ROOTDIR if unset already.

The ROOTDIR variable is used for pretty formatting during compilation.
Some users might want to have this display the build from the top of
their tree instead of the finit build tree.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
libite: Improve error handling for copyfile() and rsync()

When using the simple rsync() or copyfile() functions of libite some
error codes should not be interpreted as error.  I.e., if a file or
directory already exists when attempting to create it.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
helpers.c: Fix run() argparser, assumed all commands have args.
sig.c: Use watchdogd to reboot system

This patch reorders the shutdown/reboot handler slightly and fixes
a bug in sleep().  It seems the sleep() syscall was interrupted by
receiving lots of SIGCHLD.  Unsurprisingly since we just sent all
processes SIGTERM, but unfortunate since that was too short time
to deliver SIGTERM to watchdogd.

We now call sleep() again, as long as it returns a non-zero value,
until at most two (2) seconds have passed.  During this time we
basically pend for watchdogd to do its job and let the WDT reboot
the system.  If the two second timeout passes we send SIGKILL and
forcibly reboot(RB_AUTOBOOT) the system.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Add support for service restart counter.

This commit adds a statistics counter to the finit svc_t process struct
which is incremented every time a process is restarted by the service
monitor.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Add support for specifying TTYs and console TTY in finit.conf

This commit adds support for specifying TTY and console to be used
for starting a getty to login to the system

Add the following to your finit.conf to use this feature:

    tty ttyS0
    tty ttyUSB0
    console ttyS0

Signed-off-by: Mattias Walström <lazzer@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
tty.c: Minor cleanup and check global variable before dereferencing.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
helpers.c: Make system message optional top run_interactive()

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Add support for user/distribution specific banner at startup.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
libite: Fix memory leak in dir()

Signed-off-by: Mattias Walström <lazzer@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Add basic support for runlevels and bugfix FIFO I/O plugins

Like most other init implementations do, when entering runlevel 1, finit
creates the file /etc/nologin to prevent users from logging in during
single-user mode, this file is then removed upon leaving runlevel 1.

Also, bugfix how FIFO I/O plugins are handled in finit.  A FIFO will
need to be reopened by the server side when the client closes the pipe.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Add support for toggling the debug mode at runtime

This commit adds support for -d, --debug option to init, which can
be used to toggle the finit debug mode at runtime.

Signed-off-by: Mattias Walström <lazzer@gmail.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Fix issue with "Formatting of boot text changes in the middle of the boot."

This commit adds a line: "Loading kernel modules ..." before increasing
indentation level of module loading messages.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Update TODO

Move to use ReST syntax, like README, and update to reflect current
status of project.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>