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 && if ((s != skip_state &&
s != RC_SERVICE_STOPPED && s != RC_SERVICE_STOPPED &&
s != RC_SERVICE_COLDPLUGGED && s != RC_SERVICE_COLDPLUGGED &&
s != RC_SERVICE_SCHEDULED && s != RC_SERVICE_SCHEDULED) &&
s != RC_SERVICE_CRASHED) && (! skip_wasinactive || s != RC_SERVICE_WASINACTIVE))
(! skip_wasinactive || i != RC_SERVICE_WASINACTIVE))
{ {
file = rc_strcatpaths (RC_SVCDIR, rc_parse_service_state(s), base, file = rc_strcatpaths (RC_SVCDIR, rc_parse_service_state(s), base,
(char *) NULL); (char *) NULL);
@ -351,7 +350,7 @@ bool rc_mark_service (const char *service, const rc_service_state_t state)
s == RC_SERVICE_INACTIVE) s == RC_SERVICE_INACTIVE)
{ {
char *wasfile = rc_strcatpaths (RC_SVCDIR, char *wasfile = rc_strcatpaths (RC_SVCDIR,
rc_parse_service_state (RC_SERVICE_WASINACTIVE), rc_parse_service_state (RC_SERVICE_WASINACTIVE),
base, (char *) NULL); base, (char *) NULL);
if (symlink (init, wasfile) != 0) 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); return (state);
} }
librc_hidden_def(rc_service_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; einfo_color_t color = ECOLOR_BAD;
if (state & RC_SERVICE_STOPPING) if (state & RC_SERVICE_STOPPING)
snprintf (status, sizeof (status), "stopping "); snprintf (status, sizeof (status), "stopping ");
else if (state & RC_SERVICE_STARTING) { else if (state & RC_SERVICE_STARTING) {
snprintf (status, sizeof (status), "starting "); snprintf (status, sizeof (status), "starting ");
color = ECOLOR_WARN; color = ECOLOR_WARN;
} else if (state & RC_SERVICE_INACTIVE) { } else if (state & RC_SERVICE_INACTIVE) {
snprintf (status, sizeof (status), "inactive "); snprintf (status, sizeof (status), "inactive ");
color = ECOLOR_WARN; color = ECOLOR_WARN;
} else if (state & RC_SERVICE_CRASHED) } else if (state & RC_SERVICE_STARTED) {
snprintf (status, sizeof (status), " crashed "); if (geteuid () == 0 && rc_service_daemons_crashed (service))
else if (state & RC_SERVICE_STARTED) { snprintf (status, sizeof (status), " crashed ");
snprintf (status, sizeof (status), " started "); else {
color = ECOLOR_GOOD; snprintf (status, sizeof (status), " started ");
color = ECOLOR_GOOD;
}
} else if (state & RC_SERVICE_SCHEDULED) { } else if (state & RC_SERVICE_SCHEDULED) {
snprintf (status, sizeof (status), "scheduled"); snprintf (status, sizeof (status), "scheduled");
color = ECOLOR_WARN; color = ECOLOR_WARN;
} else } else
snprintf (status, sizeof (status), " stopped "); snprintf (status, sizeof (status), " stopped ");
ebracket (cols, color, status); ebracket (cols, color, status);
} }

View File

@ -57,9 +57,6 @@ typedef enum
RC_SERVICE_FAILED = 0x0200, RC_SERVICE_FAILED = 0x0200,
RC_SERVICE_SCHEDULED = 0x0400, RC_SERVICE_SCHEDULED = 0x0400,
RC_SERVICE_WASINACTIVE = 0x0800, RC_SERVICE_WASINACTIVE = 0x0800,
/* Regardless of state, service may have crashed daemons */
RC_SERVICE_CRASHED = 0x1000
} rc_service_state_t; } rc_service_state_t;
/*! Resolves a service name to its full path. /*! 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) { } else if (state & RC_SERVICE_INACTIVE) {
snprintf (status, sizeof (status), "inactive"); snprintf (status, sizeof (status), "inactive");
e = &ewarn; e = &ewarn;
} else if (state & RC_SERVICE_CRASHED) {
snprintf (status, sizeof (status), "crashed");
e = &eerror;
} else if (state & RC_SERVICE_STARTED) { } 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 } else
snprintf (status, sizeof (status), "stopped"); snprintf (status, sizeof (status), "stopped");