Usability, a servivce stopped by a user is stopped, not blocked

The generic term for a non-running service is blocked, but a service may
be blocked for several different reasons.  When a user stops a service
with `initctl stop` the intuitive expected output from `initctl show` is
"stopped" not "blocked".

When the user later restarts the service with `initctl start` it may of
course be blocked due to wrong runlevel or a missing condition.  As can
be expected from the service's configuration.

The rest of the patch refactors the internal API names a bit to reflect
this change.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-07-02 15:42:44 +02:00
1 parent 516dbcc512
commit 260335a19f
4 files changed
+14 -12

No files matched your search

+7 -7
View File
@@ -49,23 +49,23 @@ static int call(int (*action)(svc_t *), char *buf, size_t len)
return svc_parse_jobstr(buf, len, action, NULL);
}
static int service_block(svc_t *svc)
static int service_stop(svc_t *svc)
{
if (!svc)
return 1;
svc_block(svc);
svc_stop(svc);
service_step(svc);
return 0;
}
static int service_unblock(svc_t *svc)
static int service_start(svc_t *svc)
{
if (!svc)
return 1;
svc_unblock(svc);
svc_start(svc);
service_step(svc);
return 0;
@@ -82,8 +82,8 @@ static int service_restart(svc_t *svc)
return 0;
}
static int do_start (char *buf, size_t len) { return call(service_unblock, buf, len); }
static int do_pause (char *buf, size_t len) { return call(service_block, buf, len); }
static int do_start (char *buf, size_t len) { return call(service_start, buf, len); }
static int do_stop (char *buf, size_t len) { return call(service_stop, buf, len); }
static int do_restart(char *buf, size_t len) { return call(service_restart, buf, len); }
#ifdef INETD_ENABLED
@@ -240,7 +240,7 @@ static void cb(uev_t *w, void *UNUSED(arg), int UNUSED(events))
break;
case INIT_CMD_STOP_SVC:
result = do_pause(rq.data, sizeof(rq.data));
result = do_stop(rq.data, sizeof(rq.data));
break;
case INIT_CMD_RESTART_SVC: