killall.c revision 6bedfcbb2970e06a4d3280c8fb62083d252ede73
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering/***
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering This file is part of systemd.
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering Copyright 2010 ProFUSION embedded systems
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering systemd is free software; you can redistribute it and/or modify it
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering under the terms of the GNU Lesser General Public License as published by
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering (at your option) any later version.
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering systemd is distributed in the hope that it will be useful, but
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering Lesser General Public License for more details.
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering You should have received a copy of the GNU Lesser General Public License
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering***/
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering#include <errno.h>
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering#include <signal.h>
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering#include <sys/wait.h>
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering#include <unistd.h>
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
3ffd4af22052963e7a29431721ee204e634bea75Lennart Poettering#include "fd-util.h"
6482f6269c87d2249e52e889a63adbdd50f2d691Ronny Chevalier#include "formats-util.h"
3ffd4af22052963e7a29431721ee204e634bea75Lennart Poettering#include "killall.h"
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering#include "parse-util.h"
0b452006de98294d1690f045f6ea2f7f6630ec3bRonny Chevalier#include "process-util.h"
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering#include "set.h"
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering#include "string-util.h"
288a74cce597f81d3ba01d8a5ca7d2ba5b654b7eRonny Chevalier#include "terminal-util.h"
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering#include "util.h"
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering#define TIMEOUT_USEC (10 * USEC_PER_SEC)
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poetteringstatic bool ignore_proc(pid_t pid) {
31885cd5e38ec9807a6a7ab32660cf8c2fcf48f7Zbigniew Jędrzejewski-Szmek _cleanup_fclose_ FILE *f = NULL;
b68fa010f72599e6da5822feda5ae3a47a4e63d8Simon Peeters char c;
b68fa010f72599e6da5822feda5ae3a47a4e63d8Simon Peeters const char *p;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering size_t count;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering uid_t uid;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering int r;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering /* We are PID 1, let's not commit suicide */
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (pid == 1)
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering return true;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering r = get_process_uid(pid, &uid);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (r < 0)
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering return true; /* not really, but better safe than sorry */
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering /* Non-root processes otherwise are always subject to be killed */
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (uid != 0)
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering return false;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
5841bd803f1b651c0d70c6ae114630723a76d1daZbigniew Jędrzejewski-Szmek p = procfs_file_alloca(pid, "cmdline");
5841bd803f1b651c0d70c6ae114630723a76d1daZbigniew Jędrzejewski-Szmek f = fopen(p, "re");
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (!f)
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering return true; /* not really, but has the desired effect */
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering count = fread(&c, 1, 1, f);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering /* Kernel threads have an empty cmdline */
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (count <= 0)
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering return true;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering /* Processes with argv[0][0] = '@' we ignore from the killing
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering * spree.
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering *
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering * http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons */
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (count == 1 && c == '@')
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering return true;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering return false;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering}
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poetteringstatic void wait_for_children(Set *pids, sigset_t *mask) {
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering usec_t until;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering assert(mask);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering if (set_isempty(pids))
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering return;
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering until = now(CLOCK_MONOTONIC) + TIMEOUT_USEC;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering for (;;) {
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering struct timespec ts;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering int k;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering usec_t n;
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering void *p;
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering Iterator i;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering /* First, let the kernel inform us about killed
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering * children. Most processes will probably be our
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering * children, but some are not (might be our
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering * grandchildren instead...). */
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering for (;;) {
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering pid_t pid;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering pid = waitpid(-1, NULL, WNOHANG);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (pid == 0)
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering break;
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering if (pid < 0) {
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering if (errno == ECHILD)
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering break;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
56f64d95763a799ba4475daf44d8e9f72a1bd474Michal Schmidt log_error_errno(errno, "waitpid() failed: %m");
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering return;
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering }
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering
fea72cc0336f4d90875cdddc1aa9739dcbb174f5Lennart Poettering (void) set_remove(pids, PID_TO_PTR(pid));
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering }
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering /* Now explicitly check who might be remaining, who
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering * might not be our child. */
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering SET_FOREACH(p, pids, i) {
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering /* We misuse getpgid as a check whether a
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering * process still exists. */
fea72cc0336f4d90875cdddc1aa9739dcbb174f5Lennart Poettering if (getpgid(PTR_TO_PID(p)) >= 0)
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering continue;
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering if (errno != ESRCH)
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering continue;
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering set_remove(pids, p);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering }
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering if (set_isempty(pids))
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering return;
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering n = now(CLOCK_MONOTONIC);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (n >= until)
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering return;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering timespec_store(&ts, until - n);
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering k = sigtimedwait(mask, NULL, &ts);
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering if (k != SIGCHLD) {
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (k < 0 && errno != EAGAIN) {
56f64d95763a799ba4475daf44d8e9f72a1bd474Michal Schmidt log_error_errno(errno, "sigtimedwait() failed: %m");
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering return;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering }
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (k >= 0)
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering log_warning("sigtimedwait() returned unexpected signal.");
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering }
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering }
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering}
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poetteringstatic int killall(int sig, Set *pids, bool send_sighup) {
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering _cleanup_closedir_ DIR *dir = NULL;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering struct dirent *d;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering dir = opendir("/proc");
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (!dir)
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering return -errno;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering while ((d = readdir(dir))) {
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering pid_t pid;
60053efbbaabf084e1ecd61474fdc7235fe3da64Thomas Hindoe Paaboel Andersen int r;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (d->d_type != DT_DIR &&
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering d->d_type != DT_UNKNOWN)
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering continue;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (parse_pid(d->d_name, &pid) < 0)
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering continue;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (ignore_proc(pid))
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering continue;
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
df758e98754016119a9c8d49213a636a80ffab22Kay Sievers if (sig == SIGKILL) {
3e09eb5c83e56bc0184bd9d9c44f76047464f77cAndreas Henriksson _cleanup_free_ char *s = NULL;
df758e98754016119a9c8d49213a636a80ffab22Kay Sievers
df758e98754016119a9c8d49213a636a80ffab22Kay Sievers get_process_comm(pid, &s);
ccd06097c79218f7d5ea4c21721bbcbc7c467dcaZbigniew Jędrzejewski-Szmek log_notice("Sending SIGKILL to PID "PID_FMT" (%s).", pid, strna(s));
df758e98754016119a9c8d49213a636a80ffab22Kay Sievers }
df758e98754016119a9c8d49213a636a80ffab22Kay Sievers
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering if (kill(pid, sig) >= 0) {
60053efbbaabf084e1ecd61474fdc7235fe3da64Thomas Hindoe Paaboel Andersen if (pids) {
fea72cc0336f4d90875cdddc1aa9739dcbb174f5Lennart Poettering r = set_put(pids, PID_TO_PTR(pid));
60053efbbaabf084e1ecd61474fdc7235fe3da64Thomas Hindoe Paaboel Andersen if (r < 0)
60053efbbaabf084e1ecd61474fdc7235fe3da64Thomas Hindoe Paaboel Andersen log_oom();
60053efbbaabf084e1ecd61474fdc7235fe3da64Thomas Hindoe Paaboel Andersen }
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering } else if (errno != ENOENT)
56f64d95763a799ba4475daf44d8e9f72a1bd474Michal Schmidt log_warning_errno(errno, "Could not kill %d: %m", pid);
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering if (send_sighup) {
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering /* Optionally, also send a SIGHUP signal, but
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering only if the process has a controlling
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering tty. This is useful to allow handling of
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering shells which ignore SIGTERM but react to
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering SIGHUP. We do not send this to processes that
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering have no controlling TTY since we don't want to
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering trigger reloads of daemon processes. Also we
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering make sure to only send this after SIGTERM so
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering that SIGTERM is always first in the queue. */
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering if (get_ctty_devnr(pid, NULL) >= 0)
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering kill(pid, SIGHUP);
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering }
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering }
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering return set_size(pids);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering}
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
6301a98cdf26dc073f5317506c806bfa69f74cc8Lennart Poetteringvoid broadcast_signal(int sig, bool wait_for_exit, bool send_sighup) {
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering sigset_t mask, oldmask;
e1d758033dc7e101ab32323a0f1649d8daf56a22Ronny Chevalier _cleanup_set_free_ Set *pids = NULL;
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering if (wait_for_exit)
d5099efc47d4e6ac60816b5381a5f607ab03f06eMichal Schmidt pids = set_new(NULL);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering assert_se(sigemptyset(&mask) == 0);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering assert_se(sigaddset(&mask, SIGCHLD) == 0);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering assert_se(sigprocmask(SIG_BLOCK, &mask, &oldmask) == 0);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (kill(-1, SIGSTOP) < 0 && errno != ESRCH)
56f64d95763a799ba4475daf44d8e9f72a1bd474Michal Schmidt log_warning_errno(errno, "kill(-1, SIGSTOP) failed: %m");
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poettering killall(sig, pids, send_sighup);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering if (kill(-1, SIGCONT) < 0 && errno != ESRCH)
56f64d95763a799ba4475daf44d8e9f72a1bd474Michal Schmidt log_warning_errno(errno, "kill(-1, SIGCONT) failed: %m");
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering
3d141780b8d509e4a6c3083de207cd84cbce187bLennart Poettering if (wait_for_exit)
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering wait_for_children(pids, &mask);
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering
aaf7eb81be912e7bed939f31e3bc4c631b2552b3Lennart Poettering assert_se(sigprocmask(SIG_SETMASK, &oldmask, NULL) == 0);
bd3fa1d2434aa28564251ac4da34d01537de8c4bLennart Poettering}