process-util: make wait_for_terminate() as trivial wrapper of its PidRef version
This commit is contained in:
@@ -879,27 +879,8 @@ int get_process_umask(pid_t pid, mode_t *ret) {
|
||||
return parse_mode(m, ret);
|
||||
}
|
||||
|
||||
int wait_for_terminate(pid_t pid, siginfo_t *status) {
|
||||
siginfo_t dummy;
|
||||
|
||||
assert(pid >= 1);
|
||||
|
||||
if (!status)
|
||||
status = &dummy;
|
||||
|
||||
for (;;) {
|
||||
zero(*status);
|
||||
|
||||
if (waitid(P_PID, pid, status, WEXITED) < 0) {
|
||||
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
|
||||
return negative_errno();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
int wait_for_terminate(pid_t pid, siginfo_t *ret) {
|
||||
return pidref_wait_for_terminate(&PIDREF_MAKE_FROM_PID(pid), ret);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -65,7 +65,7 @@ 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);
|
||||
int wait_for_terminate(pid_t pid, siginfo_t *ret);
|
||||
|
||||
typedef enum WaitFlags {
|
||||
WAIT_LOG_ABNORMAL = 1 << 0,
|
||||
|
||||
Reference in New Issue
Block a user