int container_get_leader(const char *machine, pid_t *pid);
+static inline bool SIGINFO_CODE_IS_DEAD(int code) {
+ return IN_SET(code, CLD_EXITED, CLD_KILLED, CLD_DUMPED);
+}
+
int wait_for_terminate(pid_t pid, siginfo_t *status);
typedef enum WaitFlags {
if (si.si_pid <= 0)
goto turn_off;
- if (IN_SET(si.si_code, CLD_EXITED, CLD_KILLED, CLD_DUMPED)) {
+ if (SIGINFO_CODE_IS_DEAD(si.si_code)) {
_cleanup_free_ char *name = NULL;
(void) pid_get_comm(si.si_pid, &name);
return negative_errno();
if (s->child.siginfo.si_pid != 0) {
- bool zombie = IN_SET(s->child.siginfo.si_code, CLD_EXITED, CLD_KILLED, CLD_DUMPED);
+ bool zombie = SIGINFO_CODE_IS_DEAD(s->child.siginfo.si_code);
if (zombie)
s->child.exited = true;
if (s->child.siginfo.si_pid == 0)
return 0;
- if (IN_SET(s->child.siginfo.si_code, CLD_EXITED, CLD_KILLED, CLD_DUMPED))
+ if (SIGINFO_CODE_IS_DEAD(s->child.siginfo.si_code))
s->child.exited = true;
return source_set_pending(s, true);
break;
case SOURCE_CHILD: {
- bool zombie;
-
- zombie = IN_SET(s->child.siginfo.si_code, CLD_EXITED, CLD_KILLED, CLD_DUMPED);
+ bool zombie = SIGINFO_CODE_IS_DEAD(s->child.siginfo.si_code);
r = s->child.callback(s, &s->child.siginfo, s->userdata);