]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
daemon: decouple init logic from main loop
authorIhor Antonov <ihor@antonovs.family>
Thu, 23 Mar 2023 02:37:12 +0000 (21:37 -0500)
committerKyle Evans <kevans@FreeBSD.org>
Sun, 9 Apr 2023 22:49:52 +0000 (17:49 -0500)
commit81f89a76e8fa9a9fba8f8cfdf44addf8bae2d448
treea8d418be3073500e6fb35023a960dee27969531c
parent7ad1bebb0f1d4b95d6bcdb59b90f1b234e6532b4
daemon: decouple init logic from main loop

main() func contained both initialization and main loop logic.
This made certain operations like restarting problematic and
required dirty hacks in form of goto jumps.

This commit moves the main loop logic into daemon_eventloop(),
cleans up main, and makes restart logic clear: daemon_mainloop()
is run in a loop with a restart condition checked at the end.

Reviewed by: kevans

(cherry picked from commit 4c41f4a0d67fc93cfb07ad5287f02d024d19ef5a)
usr.sbin/daemon/daemon.c