Crashed is not a baselayout state as such

This commit is contained in:
Roy Marples 2007-09-28 15:04:15 +00:00
parent 7274301be2
commit fc1bfe4234
4 changed files with 17 additions and 23 deletions

View File

@ -339,9 +339,8 @@ bool rc_mark_service (const char *service, const rc_service_state_t state)
if ((s != skip_state &&
s != RC_SERVICE_STOPPED &&
s != RC_SERVICE_COLDPLUGGED &&
s != RC_SERVICE_SCHEDULED &&
s != RC_SERVICE_CRASHED) &&
(! skip_wasinactive || i != RC_SERVICE_WASINACTIVE))
s != RC_SERVICE_SCHEDULED) &&
(! skip_wasinactive || s != RC_SERVICE_WASINACTIVE))
{
file = rc_strcatpaths (RC_SVCDIR, rc_parse_service_state(s), base,
(char *) NULL);
@ -351,7 +350,7 @@ bool rc_mark_service (const char *service, const rc_service_state_t state)
s == RC_SERVICE_INACTIVE)
{
char *wasfile = rc_strcatpaths (RC_SVCDIR,
rc_parse_service_state (RC_SERVICE_WASINACTIVE),
rc_parse_service_state (RC_SERVICE_WASINACTIVE),
base, (char *) NULL);
if (symlink (init, wasfile) != 0)
@ -457,11 +456,6 @@ rc_service_state_t rc_service_state (const char *service)
}
}
if (state & RC_SERVICE_STARTED && geteuid () == 0) {
if (rc_service_daemons_crashed (service))
state |= RC_SERVICE_CRASHED;
}
return (state);
}
librc_hidden_def(rc_service_state)

View File

@ -35,23 +35,25 @@ static void print_service (char *service)
einfo_color_t color = ECOLOR_BAD;
if (state & RC_SERVICE_STOPPING)
snprintf (status, sizeof (status), "stopping ");
snprintf (status, sizeof (status), "stopping ");
else if (state & RC_SERVICE_STARTING) {
snprintf (status, sizeof (status), "starting ");
color = ECOLOR_WARN;
} else if (state & RC_SERVICE_INACTIVE) {
snprintf (status, sizeof (status), "inactive ");
color = ECOLOR_WARN;
} else if (state & RC_SERVICE_CRASHED)
snprintf (status, sizeof (status), " crashed ");
else if (state & RC_SERVICE_STARTED) {
snprintf (status, sizeof (status), " started ");
color = ECOLOR_GOOD;
} else if (state & RC_SERVICE_STARTED) {
if (geteuid () == 0 && rc_service_daemons_crashed (service))
snprintf (status, sizeof (status), " crashed ");
else {
snprintf (status, sizeof (status), " started ");
color = ECOLOR_GOOD;
}
} else if (state & RC_SERVICE_SCHEDULED) {
snprintf (status, sizeof (status), "scheduled");
color = ECOLOR_WARN;
} else
snprintf (status, sizeof (status), " stopped ");
snprintf (status, sizeof (status), " stopped ");
ebracket (cols, color, status);
}

View File

@ -57,9 +57,6 @@ typedef enum
RC_SERVICE_FAILED = 0x0200,
RC_SERVICE_SCHEDULED = 0x0400,
RC_SERVICE_WASINACTIVE = 0x0800,
/* Regardless of state, service may have crashed daemons */
RC_SERVICE_CRASHED = 0x1000
} rc_service_state_t;
/*! Resolves a service name to its full path.

View File

@ -459,11 +459,12 @@ static rc_service_state_t svc_status ()
} else if (state & RC_SERVICE_INACTIVE) {
snprintf (status, sizeof (status), "inactive");
e = &ewarn;
} else if (state & RC_SERVICE_CRASHED) {
snprintf (status, sizeof (status), "crashed");
e = &eerror;
} else if (state & RC_SERVICE_STARTED) {
snprintf (status, sizeof (status), "started");
if (geteuid () == 0 && rc_service_daemons_crashed (service)) {
snprintf (status, sizeof (status), "crashed");
e = &eerror;
} else
snprintf (status, sizeof (status), "started");
} else
snprintf (status, sizeof (status), "stopped");