mirror of
https://github.com/troglobit/finit.git
synced 2026-11-24 20:21:44 +00:00
Take down condition subsystem at shutdown/reboot
Leave the system as it was when we found it. Also, we'll build things on top of cond_is_available() to handle pre bootstrap and pre shutdown tasks. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
585ac51f45
commit
5f74adad06
3 files changed
+20
No files matched your search
@@ -410,6 +410,15 @@ void cond_deassert(const char *pat)
|
|||||||
nftw(cond_path(pat), deassert, 20, FTW_DEPTH);
|
nftw(cond_path(pat), deassert, 20, FTW_DEPTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if we have bootstrapped enough of the system to use conditions.
|
||||||
|
* Will answer 'No' before bootstrap done *and* at shutdown/reboot.
|
||||||
|
*/
|
||||||
|
int cond_is_available(void)
|
||||||
|
{
|
||||||
|
return fisdir(_PATH_COND);
|
||||||
|
}
|
||||||
|
|
||||||
void cond_init(void)
|
void cond_init(void)
|
||||||
{
|
{
|
||||||
char path[MAX_ARG_LEN];
|
char path[MAX_ARG_LEN];
|
||||||
@@ -423,6 +432,11 @@ void cond_init(void)
|
|||||||
cond_boot_strap();
|
cond_boot_strap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cond_exit(void)
|
||||||
|
{
|
||||||
|
cond_delpath(_PATH_COND);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Local Variables:
|
* Local Variables:
|
||||||
* indent-tabs-mode: t
|
* indent-tabs-mode: t
|
||||||
|
|||||||
@@ -46,7 +46,10 @@ int cond_clear_noupdate(const char *name);
|
|||||||
void cond_reassert (const char *pat);
|
void cond_reassert (const char *pat);
|
||||||
void cond_deassert (const char *pat);
|
void cond_deassert (const char *pat);
|
||||||
|
|
||||||
|
int cond_is_available(void);
|
||||||
|
|
||||||
void cond_init (void);
|
void cond_init (void);
|
||||||
|
void cond_exit (void);
|
||||||
|
|
||||||
#endif /* FINIT_COND_H_ */
|
#endif /* FINIT_COND_H_ */
|
||||||
|
|
||||||
|
|||||||
@@ -322,6 +322,9 @@ void do_shutdown(shutop_t op)
|
|||||||
plugin_exit();
|
plugin_exit();
|
||||||
api_exit();
|
api_exit();
|
||||||
|
|
||||||
|
/* We can no longer act on conditions, activate script runner */
|
||||||
|
cond_exit();
|
||||||
|
|
||||||
/* Reap 'em */
|
/* Reap 'em */
|
||||||
while (waitpid(-1, NULL, WNOHANG) > 0)
|
while (waitpid(-1, NULL, WNOHANG) > 0)
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in new issue
Block a user