diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-12-11 20:01:55 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-05-30 07:49:34 +0200 |
commit | 3e57e6c7203e7a659bb4b3cca3bc7383488787a2 (patch) | |
tree | 1f7be153e6b96a908204a36317b03802c3cfeaa1 /src/basic/process-util.c | |
parent | 49f31f9f4ff7491b3cd6e2fd30b5d8ff95b2f62a (diff) |
basic: turn off stdio locking for a couple of helper calls
These helper calls are potentially called often, and allocate FILE*
objects internally for a very short period of time, let's turn off
locking for them too.
Diffstat (limited to 'src/basic/process-util.c')
-rw-r--r-- | src/basic/process-util.c | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 1c77195e8..611fd2339 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -715,67 +715,6 @@ int wait_for_terminate_and_warn(const char *name, pid_t pid, bool check_exit_cod } #if 0 /// UNNEEDED by elogind -/* - * Return values: - * < 0 : wait_for_terminate_with_timeout() failed to get the state of the - * process, the process timed out, the process was terminated by a - * signal, or failed for an unknown reason. - * >=0 : The process terminated normally with no failures. - * - * Success is indicated by a return value of zero, a timeout is indicated - * by ETIMEDOUT, and all other child failure states are indicated by error - * is indicated by a non-zero value. - */ -int wait_for_terminate_with_timeout(pid_t pid, usec_t timeout) { - sigset_t mask; - int r; - usec_t until; - - assert_se(sigemptyset(&mask) == 0); - assert_se(sigaddset(&mask, SIGCHLD) == 0); - - /* Drop into a sigtimewait-based timeout. Waiting for the - * pid to exit. */ - until = now(CLOCK_MONOTONIC) + timeout; - for (;;) { - usec_t n; - siginfo_t status = {}; - struct timespec ts; - - n = now(CLOCK_MONOTONIC); - if (n >= until) - break; - - r = sigtimedwait(&mask, NULL, timespec_store(&ts, until - n)) < 0 ? -errno : 0; - /* Assuming we woke due to the child exiting. */ - if (waitid(P_PID, pid, &status, WEXITED|WNOHANG) == 0) { - if (status.si_pid == pid) { - /* This is the correct child.*/ - if (status.si_code == CLD_EXITED) - return (status.si_status == 0) ? 0 : -EPROTO; - else - return -EPROTO; - } - } - /* Not the child, check for errors and proceed appropriately */ - if (r < 0) { - switch (r) { - case -EAGAIN: - /* Timed out, child is likely hung. */ - return -ETIMEDOUT; - case -EINTR: - /* Received a different signal and should retry */ - continue; - default: - /* Return any unexpected errors */ - return r; - } - } - } - - return -EPROTO; -} - void sigkill_wait(pid_t pid) { assert(pid > 1); |