mirror of
https://github.com/troglobit/finit.git
synced 2026-11-12 16:51:25 +00:00
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:
1 parent
516dbcc512
commit
260335a19f
4 files changed
+14
-12
No files matched your search
@@ -92,7 +92,7 @@ typedef struct svc {
|
||||
int starting; /* ... waiting for pidfile to be re-asserted */
|
||||
int runlevels;
|
||||
int sighup; /* This service supports SIGHUP :) */
|
||||
svc_block_t block; /* Reason that this service is currently blocked */
|
||||
svc_block_t block; /* Reason that this service is currently stopped */
|
||||
char cond[MAX_ARG_LEN];
|
||||
|
||||
/* Incremented for each restart by service monitor. */
|
||||
@@ -192,7 +192,8 @@ static inline int svc_is_daemon (svc_t *svc) { return svc && SVC_TYPE_SERVICE
|
||||
static inline int svc_is_blocked (svc_t *svc) { return svc->block != SVC_BLOCK_NONE; }
|
||||
static inline int svc_is_busy (svc_t *svc) { return svc->block == SVC_BLOCK_BUSY; }
|
||||
static inline void svc_unblock (svc_t *svc) { svc->block = SVC_BLOCK_NONE; }
|
||||
static inline void svc_block (svc_t *svc) { svc->block = SVC_BLOCK_USER; }
|
||||
#define svc_start(svc) svc_unblock(svc)
|
||||
static inline void svc_stop (svc_t *svc) { svc->block = SVC_BLOCK_USER; }
|
||||
static inline void svc_busy (svc_t *svc) { svc->block = SVC_BLOCK_BUSY; }
|
||||
static inline void svc_missing (svc_t *svc) { svc->block = SVC_BLOCK_MISSING; }
|
||||
static inline void svc_restarting (svc_t *svc) { svc->block = SVC_BLOCK_RESTARTING; }
|
||||
|
||||
Reference in new issue
Block a user