- 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>
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>
We also want this meachanism to still work for manually started
service (especially after reloading services).
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
- 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>
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>
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>
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>
- 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>