mirror of
https://github.com/troglobit/finit.git
synced 2026-10-30 12:50:34 +00:00
Refactor, relocate+rename service_enabled() --> svc_enabled()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
b182e6bcc5
commit
60eccbac31
4 files changed
+25
-25
No files matched your search
+1
-24
@@ -47,29 +47,6 @@
|
|||||||
|
|
||||||
static void svc_set_state(svc_t *svc, svc_state_t new);
|
static void svc_set_state(svc_t *svc, svc_state_t new);
|
||||||
|
|
||||||
/**
|
|
||||||
* service_enabled - Should the service run?
|
|
||||||
* @svc: Pointer to &svc_t object
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* 1, if the service is allowed to run in the current runlevel and the
|
|
||||||
* user has not manually requested that this service should not run. 0
|
|
||||||
* otherwise.
|
|
||||||
*/
|
|
||||||
int service_enabled(svc_t *svc)
|
|
||||||
{
|
|
||||||
if (!svc)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!svc_in_runlevel(svc, runlevel))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (svc_is_removed(svc) || svc_is_blocked(svc))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* service_timeout_cb - libuev callback wrapper for service timeouts
|
* service_timeout_cb - libuev callback wrapper for service timeouts
|
||||||
* @w: Watcher
|
* @w: Watcher
|
||||||
@@ -845,7 +822,7 @@ void service_step(svc_t *svc)
|
|||||||
|
|
||||||
restart:
|
restart:
|
||||||
old_state = svc->state;
|
old_state = svc->state;
|
||||||
enabled = service_enabled(svc);
|
enabled = svc_enabled(svc);
|
||||||
|
|
||||||
_d("%20s(%4d): %8s %3sabled/%-7s cond:%-4s", svc->cmd, svc->pid,
|
_d("%20s(%4d): %8s %3sabled/%-7s cond:%-4s", svc->cmd, svc->pid,
|
||||||
svc_status(svc), enabled ? "en" : "dis", svc_dirtystr(svc),
|
svc_status(svc), enabled ? "en" : "dis", svc_dirtystr(svc),
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
void service_runlevel (int newlevel);
|
void service_runlevel (int newlevel);
|
||||||
int service_register (int type, char *line, struct rlimit rlimit[], struct timeval *mtime);
|
int service_register (int type, char *line, struct rlimit rlimit[], struct timeval *mtime);
|
||||||
void service_unregister (svc_t *svc);
|
void service_unregister (svc_t *svc);
|
||||||
int service_enabled (svc_t *svc);
|
|
||||||
|
|
||||||
void service_reload_dynamic (void);
|
void service_reload_dynamic (void);
|
||||||
|
|
||||||
|
|||||||
@@ -503,6 +503,29 @@ void svc_prune_bootstrap(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* svc_enabled - Should the service run?
|
||||||
|
* @svc: Pointer to &svc_t object
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 1, if the service is allowed to run in the current runlevel and the
|
||||||
|
* user has not manually requested that this service should not run. 0
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
int svc_enabled(svc_t *svc)
|
||||||
|
{
|
||||||
|
if (!svc)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!svc_in_runlevel(svc, runlevel))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (svc_is_removed(svc) || svc_is_blocked(svc))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
char *svc_status(svc_t *svc)
|
char *svc_status(svc_t *svc)
|
||||||
{
|
{
|
||||||
switch (svc->state) {
|
switch (svc->state) {
|
||||||
|
|||||||
@@ -173,6 +173,7 @@ void svc_clean_dynamic (void (*cb)(svc_t *));
|
|||||||
int svc_clean_bootstrap (svc_t *svc);
|
int svc_clean_bootstrap (svc_t *svc);
|
||||||
void svc_prune_bootstrap (void);
|
void svc_prune_bootstrap (void);
|
||||||
|
|
||||||
|
int svc_enabled (svc_t *svc);
|
||||||
char *svc_status (svc_t *svc);
|
char *svc_status (svc_t *svc);
|
||||||
const char *svc_dirtystr (svc_t *svc);
|
const char *svc_dirtystr (svc_t *svc);
|
||||||
int svc_next_id (char *cmd);
|
int svc_next_id (char *cmd);
|
||||||
|
|||||||
Reference in new issue
Block a user