mirror of
https://github.com/troglobit/finit.git
synced 2026-11-06 15:51:03 +00:00
Refactor svc_status() used by 'initctl show'
Leverage new svc_t states in initctl status/show output. Also, ensure different svc_t types have correct start state. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
b4ccc8b008
commit
1f88e1ff8a
3 files changed
+28
-6
No files matched your search
@@ -379,16 +379,36 @@ int svc_clean_bootstrap(svc_t *svc)
|
||||
|
||||
char *svc_status(svc_t *svc)
|
||||
{
|
||||
if (svc->pid)
|
||||
return "running";
|
||||
|
||||
if (!svc_in_runlevel(svc, runlevel))
|
||||
return "halted";
|
||||
return "stopped";
|
||||
|
||||
if (svc_is_inetd(svc))
|
||||
switch (svc->state) {
|
||||
case SVC_WAITING_STATE:
|
||||
return "waiting";
|
||||
|
||||
return "stopped";
|
||||
case SVC_PAUSED_STATE:
|
||||
return "paused";
|
||||
|
||||
case SVC_CONDHALT_STATE:
|
||||
return "nocond";
|
||||
|
||||
case SVC_RESTART_STATE:
|
||||
return "restart";
|
||||
|
||||
case SVC_RELOAD_STATE:
|
||||
return "reload";
|
||||
|
||||
case SVC_RUNNING_STATE:
|
||||
if (svc->pid)
|
||||
return "running";
|
||||
/* Fall through */
|
||||
|
||||
case SVC_HALTED_STATE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "halted";
|
||||
}
|
||||
|
||||
/* Same base service, return unique ID */
|
||||
|
||||
Reference in new issue
Block a user