along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <sys/wait.h>
-#include <signal.h>
#include <errno.h>
+#include <signal.h>
+#include <sys/wait.h>
#include <unistd.h>
-#include "util.h"
-#include "def.h"
+#include "fd-util.h"
+#include "formats-util.h"
#include "killall.h"
+#include "parse-util.h"
+#include "process-util.h"
#include "set.h"
+#include "string-util.h"
+#include "terminal-util.h"
+#include "util.h"
#define TIMEOUT_USEC (10 * USEC_PER_SEC)
return;
}
- set_remove(pids, ULONG_TO_PTR(pid));
+ (void) set_remove(pids, PID_TO_PTR(pid));
}
/* Now explicitly check who might be remaining, who
/* We misuse getpgid as a check whether a
* process still exists. */
- if (getpgid((pid_t) PTR_TO_ULONG(p)) >= 0)
+ if (getpgid(PTR_TO_PID(p)) >= 0)
continue;
if (errno != ESRCH)
while ((d = readdir(dir))) {
pid_t pid;
+ int r;
if (d->d_type != DT_DIR &&
d->d_type != DT_UNKNOWN)
}
if (kill(pid, sig) >= 0) {
- if (pids)
- set_put(pids, ULONG_TO_PTR(pid));
+ if (pids) {
+ r = set_put(pids, PID_TO_PTR(pid));
+ if (r < 0)
+ log_oom();
+ }
} else if (errno != ENOENT)
log_warning_errno(errno, "Could not kill %d: %m", pid);