aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-05-09Fix accidental release of "waiting" stateDavid Oberhollenzer
If a singleshot service terminates, don't change the "waiting" sate. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-05-09Minor simplifications/cleanupsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-05-08Simplify status printingDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-05-08Cleanup: remove rest of status.cDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-05-08Implement a "subreaper" service flagDavid Oberhollenzer
For particularly hostile daemons. 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-05-06Do not close stdin/out/err file descriptors in runsvcDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-04-24Add a fallback for close_all_files if procfs isn't mountedDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-04-24Cleanup: remove flag mechanism from config parser entirelyDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-04-24Cleanup: remove rdsvc flagsDavid Oberhollenzer
With the previous changes, there were only used by the status command. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-04-24cleanup: merge runsvc back into initdDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-04-06runsvc: make sure we close all fds before running a serviceDavid Oberhollenzer
Just in case initd leaks anything. Also, the service has no buisness writing all over /dev/console. It's a system service, it better use syslog or its own internal logging service. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-04-06cleanup: simplify runsvc environment config parsingDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-03-31cleanup: delete remains of libutilDavid Oberhollenzer
- exec_t belongs to service.h, the main place where it is used/needed - code for executing exec_t is moved to runsvc for the same reason - what is left are NORETURN and ARRAY_SIZE - the former can be replaced with direct attribute usage since the only relevant compilers all support the attribute. - the later is only used in 3 places and can be trivially replaced with direct usage of sizeof(). 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-06-16Add RDSVC_NO_DESC flagDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-06-16Remove unused SOCK_FLAG_* enumDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-06-16Fix remove by idDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29Release init-0.10v0.10David Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29fix: actually remove started service from listDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29Keep original respawn limitDavid Oberhollenzer
We also want this meachanism to still work for manually started service (especially after reloading services). Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29cleanup: init socket wire formatDavid Oberhollenzer
Replace array adhockery with structs and make use of the handy endianness conversion macros. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29cleanup: init status responseDavid Oberhollenzer
- rename init_status_response_t to init_status_t - merge code for handling it - fix memory leak in status command Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29cleanup: move init specific stuff of init socket to initdDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29Update documentationDavid Oberhollenzer
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 service toolDavid Oberhollenzer
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-28Include service ID in initsock status responseDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-28initd: Hand out unique IDs to servicesDavid 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-27Use fixed size integer for init socket requestDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-25Fix: actually process SIGUSR1 in initdDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-24Add hacky utiliy that waits for the presence of some filesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-21Make service status matching fuzzier (also allow service name match)David 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-20initd: don't start runsvc for services without exec blockDavid Oberhollenzer
First in rdsvc, tag the services that *do* have exec lines, even if we don't read them. Second, if a service does not have that flag set, don't try to execute it. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-20cleanup runsvc: merge codepaths for execution, remove cleanup codeDavid Oberhollenzer
Simply execute the last entry in the list directly instead of forking and remove the cleanup code. If the list is empty, we return success. If the list only has one entry, we directly execute that. No need to make a distinction between single entry vs list anymore. If the list is an actual list, we run it as before but execute the last one directly. Typically, the last one is something like a daemon preceeded by setup code. The daemon ends up directly underneath init, without a dummy waiting runsvc stuck in the process list. If we always do an exec, there is no point in doing cleanup. All our mapped memory is evicted anyway. Same if we exit appruptly because of an error. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-20Dump more information in service status commandDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-19Seperate service loading/error loging from dumpscript commandDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-18cleanup: remove broken stat ... open patternDavid Oberhollenzer
confused deputy is confused. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-18Add filtering parameters to status commandDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-18Cleanup status reportingDavid Oberhollenzer
- mimic format of initd - skip formatting if not a tty - distinguish exited because failed vs exited because done Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-18Add status report command to service command line utilityDavid 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 functions to transmit service status accross initd socketDavid Oberhollenzer
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>
2019-03-18Add helpers for initd socketDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>