aboutsummaryrefslogtreecommitdiff
path: root/initd/main.c
AgeCommit message (Collapse)Author
2020-05-13Some simplfications in initd mainDavid Oberhollenzer
- Move the code of the supervisor main loop function into the main loop. - Remove the set target function and set the target variable directly in the signal handler. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-05-13Move rest of initd supervisor code into main.cDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-05-13Move the rest of the main loop into supervisor_process_queuesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-05-13Cleanup: Remove SIGCHLD handler from initdDavid Oberhollenzer
Instead use wait() in the main loop. This way, the supervisor functions (except set target) are no longer called from signal context and can be simplified a little. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-05-09Minor simplifications/cleanupsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-05-08Cleanup: complete redesign of the initd supervisorDavid Oberhollenzer
- Cleanly seperate service description parsed from file from the actual run-time data. - Remove the use of the signalfd and make asyncronous calls into the supervisor from signal context work. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-05-07Temporarily remove initsock handling codeDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-05-07Temporarily remove service reload abilityDavid Oberhollenzer
A cleaner, more planned out version will be added back later. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-03-31cleanup: initd: simplify and merge linux specific code into main.cDavid Oberhollenzer
Targetting anything else than Linux isn't really relevant. All other systems ($BSD and other Unices) are a closed ecosystem where kernel & userspace are developed together. They don't need something like a third party init system, so compatibillity can be largely ignored. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29Add service configuration reloadingDavid Oberhollenzer
This commit add the ability to initd to reload the service configuration while running. The new configuration is merged with the existing one as follows: For each target: - If the existing service list is not NULL, we have not started that target yet. Simply replace it with the new list. - If it is NULL, the services have already been started. - First, remove all entries for services in that target that no loner exist (except from the 'running' list). - Second, add new services that we don't have yet. Treat them as recently diseased and let the user start them manualy. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-28Add start/stop commands to init socketDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-27Add filter argument to status requestDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-20Fix warnings from gcc 8.3 + musl buildDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-18initd: implement handling of socket requestsDavid Oberhollenzer
Actually process requests and send an answer to status inquiries. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-18Add init socket to initdDavid Oberhollenzer
Create a socket if boot target is done. Close and reopen socket if SIGUSR1 is received. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2018-11-23Relicense what is left of the init system under OpenBSD style ISC licenseDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-04Remove unused telinit codeDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-24initd: automatically do a shutdown/reboot when the target is completedDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-24initd: accept sigterm and simply initiate shutdown targetDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-24Remove ctrl+alt+del target, simply initiate reboot targetDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-24initd: restructure and merge service supervision codeDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-06-09Make mksock() more generic, move to util libraryDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-22Add helper program for running servicesDavid Oberhollenzer
We no longer need to keep entire scripts in init program (i.e. saving space) and reduce the code and complexity of the init program. The runsvc tool can later be extended to do more complex child setup, such as configuring namespaces or seccomp without adding complexity or memory footprint to init. Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-22Add flags to selectively skip fields in service filesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-15Move initd signal setup to platform specific fileDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-07Minor cleanupDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-07Remove setup_tty functionDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-07Create init socket after reaching boot targetDavid Oberhollenzer
Filesystem might not be available before then. Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-04Merge preprocessing of command linesDavid Oberhollenzer
- Common function for splitting string into argument vector - Preprocess & split command lines while parsing the service file - Specify "before" and "after" dependencies in a single line Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-03-26Add service respawn limitDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-03-25Print status when starting a service marked as respawnDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-03-25Use services to implement shutdown/reboot sequenceDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-03-25Unify naming of service to shorthand svcDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-03-24Add license headers and comments to sourceDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-03-24Initial commitDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>