systemd_remount_api_vfs_SOURCES = \
src/remount-api-vfs.c \
- src/mount-setup.c
+ src/mount-setup.c \
+ src/exit-status.c
systemd_remount_api_vfs_CFLAGS = \
$(AM_CFLAGS)
***/
#include <stdlib.h>
+#include <sys/wait.h>
#include "exit-status.h"
return NULL;
}
+
+
+bool is_clean_exit(int code, int status) {
+
+ if (code == CLD_EXITED)
+ return status == 0;
+
+ /* If a daemon does not implement handlers for some of the
+ * signals that's not considered an unclean shutdown */
+ if (code == CLD_KILLED)
+ return
+ status == SIGHUP ||
+ status == SIGINT ||
+ status == SIGTERM ||
+ status == SIGPIPE;
+
+ return false;
+}
+
+bool is_clean_exit_lsb(int code, int status) {
+
+ if (is_clean_exit(code, status))
+ return true;
+
+ return
+ code == CLD_EXITED &&
+ (status == EXIT_NOTINSTALLED || status == EXIT_NOTCONFIGURED);
+}
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <stdbool.h>
+
typedef enum ExitStatus {
/* EXIT_SUCCESS defined by libc */
/* EXIT_FAILURE defined by libc */
const char* exit_status_to_string(ExitStatus status, ExitStatusLevel level);
+bool is_clean_exit(int code, int status);
+bool is_clean_exit_lsb(int code, int status);
+
#endif
#include "dbus-mount.h"
#include "special.h"
#include "bus-errors.h"
+#include "exit-status.h"
static const UnitActiveState state_translation_table[_MOUNT_STATE_MAX] = {
[MOUNT_DEAD] = UNIT_INACTIVE,
#include "util.h"
#include "set.h"
#include "mount-setup.h"
+#include "exit-status.h"
/* Goes through /etc/fstab and remounts all API file systems, applying
* options that are in /etc/fstab that systemd might not have
#include "dbus-service.h"
#include "special.h"
#include "bus-errors.h"
+#include "exit-status.h"
#define COMMENTS "#;\n"
#define NEWLINES "\n\r"
#include "special.h"
#include "bus-errors.h"
#include "label.h"
+#include "exit-status.h"
static const UnitActiveState state_translation_table[_SOCKET_STATE_MAX] = {
[SOCKET_DEAD] = UNIT_INACTIVE,
#include "dbus-swap.h"
#include "special.h"
#include "bus-errors.h"
+#include "exit-status.h"
static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = {
[SWAP_DEAD] = UNIT_INACTIVE,
LIST_FOREACH(exec, p, i->exec) {
char *t;
+ bool good;
/* Only show exited processes here */
if (p->code == 0)
continue;
t = strv_join(p->argv, " ");
- printf("\t Process: %u %s=%s (code=%s, ", p->pid, p->name, strna(t), sigchld_code_to_string(p->code));
+ printf("\t Process: %u %s=%s ", p->pid, p->name, strna(t));
free(t);
+#ifdef HAVE_SYSV_COMPAT
+ if (i->is_sysv)
+ good = is_clean_exit_lsb(p->code, p->status);
+ else
+#endif
+ good = is_clean_exit(p->code, p->status);
+
+ if (!good) {
+ on = ansi_highlight(true);
+ off = ansi_highlight(false);
+ } else
+ on = off = "";
+
+ printf("%s(code=%s, ", on, sigchld_code_to_string(p->code));
+
if (p->code == CLD_EXITED) {
const char *c;
} else
printf("signal=%s", signal_to_string(p->status));
- printf(")\n");
+
+ printf(")%s\n", off);
+
+ on = off = NULL;
if (i->main_pid == p->pid &&
i->start_timestamp == p->start_timestamp &&
return make_stdio(null_fd);
}
-bool is_clean_exit(int code, int status) {
-
- if (code == CLD_EXITED)
- return status == 0;
-
- /* If a daemon does not implement handlers for some of the
- * signals that's not considered an unclean shutdown */
- if (code == CLD_KILLED)
- return
- status == SIGHUP ||
- status == SIGINT ||
- status == SIGTERM ||
- status == SIGPIPE;
-
- return false;
-}
-
-bool is_clean_exit_lsb(int code, int status) {
-
- if (is_clean_exit(code, status))
- return true;
-
- return
- code == CLD_EXITED &&
- (status == EXIT_NOTINSTALLED || status == EXIT_NOTCONFIGURED);
-}
-
bool is_device_path(const char *path) {
/* Returns true on paths that refer to a device, either in
int make_stdio(int fd);
int make_null_stdio(void);
-bool is_clean_exit(int code, int status);
-bool is_clean_exit_lsb(int code, int status);
-
unsigned long long random_ull(void);
#define DEFINE_STRING_TABLE_LOOKUP(name,type) \