From 25947a776f0a25e245354a8653483d744c6b95be Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Mon, 15 Jan 2018 21:16:26 +0000 Subject: [PATCH] Add getpgid stub to bp_sys namespace. This is another function we need to mock/stub for tests. --- src/baseproc-service.cc | 2 +- src/includes/baseproc-sys.h | 1 + src/tests/test-includes/baseproc-sys.h | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/baseproc-service.cc b/src/baseproc-service.cc index a424c2a..3692ef7 100644 --- a/src/baseproc-service.cc +++ b/src/baseproc-service.cc @@ -308,7 +308,7 @@ void base_process_service::kill_with_fire() noexcept void base_process_service::kill_pg(int signo) noexcept { - pid_t pgid = getpgid(pid); + pid_t pgid = bp_sys::getpgid(pid); if (pgid == -1) { // only should happen if pid is invalid, which should never happen... log(loglevel_t::ERROR, get_name(), ": can't signal process: ", strerror(errno)); diff --git a/src/includes/baseproc-sys.h b/src/includes/baseproc-sys.h index 05ebbd3..e410ebe 100644 --- a/src/includes/baseproc-sys.h +++ b/src/includes/baseproc-sys.h @@ -5,5 +5,6 @@ using dasynq::pipe2; using ::fcntl; using ::close; using ::kill; +using ::getpgid; } diff --git a/src/tests/test-includes/baseproc-sys.h b/src/tests/test-includes/baseproc-sys.h index fbe4a61..bbae1f1 100644 --- a/src/tests/test-includes/baseproc-sys.h +++ b/src/tests/test-includes/baseproc-sys.h @@ -22,4 +22,9 @@ inline int kill(pid_t pid, int sig) return 0; } +inline pid_t getpgid(pid_t pid) +{ + return pid; +} + } -- 2.25.1