From c7656e66220cb386dc541e77712919911926f127 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Mon, 4 Feb 2019 17:11:34 +0100 Subject: [PATCH] Remove run_as_keepalive Dead code, innit? --- src/postfork.cpp | 12 ------------ src/postfork.h | 3 --- 2 files changed, 15 deletions(-) diff --git a/src/postfork.cpp b/src/postfork.cpp index d8ce8272e..a9e7b94e9 100644 --- a/src/postfork.cpp +++ b/src/postfork.cpp @@ -406,15 +406,3 @@ bool do_builtin_io(const char *out, size_t outlen, const char *err, size_t errle errno = saved_errno; return success; } - -void run_as_keepalive(pid_t parent_pid) { - // Run this process as a keepalive. In typical usage the parent process will kill us. However - // this may not happen if the parent process exits abruptly, either via kill or exec. What we do - // is poll our ppid() and exit when it differs from parent_pid. We can afford to do this with - // low frequency because in the great majority of cases, fish will kill(9) us. - for (;;) { - // Note sleep is async-safe. - if (sleep(1)) break; - if (getppid() != parent_pid) break; - } -} diff --git a/src/postfork.h b/src/postfork.h index d91d335cf..27c9d57bb 100644 --- a/src/postfork.h +++ b/src/postfork.h @@ -48,9 +48,6 @@ bool do_builtin_io(const char *out, size_t outlen, const char *err, size_t errle void safe_report_exec_error(int err, const char *actual_cmd, const char *const *argv, const char *const *envv); -/// Runs the process as a keepalive, until the parent process given by parent_pid exits. -void run_as_keepalive(pid_t parent_pid); - #if FISH_USE_POSIX_SPAWN /// Initializes and fills in a posix_spawnattr_t; on success, the caller should destroy it via /// posix_spawnattr_destroy.