From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7BB541396D0 for ; Fri, 15 Sep 2017 18:31:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C87501FC051; Fri, 15 Sep 2017 18:31:44 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 98E171FC051 for ; Fri, 15 Sep 2017 18:31:44 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 695BD33BE95 for ; Fri, 15 Sep 2017 18:31:43 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0E6B3907A for ; Fri, 15 Sep 2017 18:31:42 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1505431479.b0a077a35f85e266fdb82a245dcbda18664a8567.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/rc-schedules.c src/rc/rc-schedules.h src/rc/start-stop-daemon.c src/rc/supervise-daemon.c X-VCS-Directories: src/rc/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: b0a077a35f85e266fdb82a245dcbda18664a8567 X-VCS-Branch: master Date: Fri, 15 Sep 2017 18:31:42 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d32d3767-2327-4b87-9506-e5a15b7a7ce6 X-Archives-Hash: 1f08e15489fa42190d181d4ef8c700ee commit: b0a077a35f85e266fdb82a245dcbda18664a8567 Author: William Hubbs gmail com> AuthorDate: Thu Sep 14 23:24:31 2017 +0000 Commit: William Hubbs gentoo org> CommitDate: Thu Sep 14 23:24:39 2017 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=b0a077a3 add quiet switch to do_stop in src-schedules.c This allows supervise-daemon to run this code without attempting to print some status messages used by start-stop-daemon. src/rc/rc-schedules.c | 13 ++++++++----- src/rc/rc-schedules.h | 2 +- src/rc/start-stop-daemon.c | 4 ++-- src/rc/supervise-daemon.c | 7 ++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/rc/rc-schedules.c b/src/rc/rc-schedules.c index 1b235a8d..13f615ee 100644 --- a/src/rc/rc-schedules.c +++ b/src/rc/rc-schedules.c @@ -253,7 +253,7 @@ void parse_schedule(const char *applet, const char *string, int timeout) /* return number of processes killed, -1 on error */ int do_stop(const char *applet, const char *exec, const char *const *argv, - pid_t pid, uid_t uid,int sig, bool test) + pid_t pid, uid_t uid,int sig, bool test, bool quiet) { RC_PIDLIST *pids; RC_PID *pi; @@ -274,11 +274,13 @@ int do_stop(const char *applet, const char *exec, const char *const *argv, einfo("Would send signal %d to PID %d", sig, pi->pid); nkilled++; } else { - ebeginv("Sending signal %d to PID %d", sig, pi->pid); + if (!quiet) + ebeginv("Sending signal %d to PID %d", sig, pi->pid); errno = 0; killed = (kill(pi->pid, sig) == 0 || errno == ESRCH ? true : false); - eendv(killed ? 0 : 1, + if (! quiet) + eendv(killed ? 0 : 1, "%s: failed to send signal %d to PID %d: %s", applet, sig, pi->pid, strerror(errno)); if (!killed) { @@ -335,7 +337,8 @@ int run_stop_schedule(const char *applet, case SC_SIGNAL: nrunning = 0; - nkilled = do_stop(applet, exec, argv, pid, uid, item->value, test); + nkilled = do_stop(applet, exec, argv, pid, uid, item->value, test, + quiet); if (nkilled == 0) { if (tkilled == 0) { if (progressed) @@ -364,7 +367,7 @@ int run_stop_schedule(const char *applet, nloops++) { if ((nrunning = do_stop(applet, exec, argv, - pid, uid, 0, test)) == 0) + pid, uid, 0, test, quiet)) == 0) return 0; diff --git a/src/rc/rc-schedules.h b/src/rc/rc-schedules.h index a42ea0e3..234e62df 100644 --- a/src/rc/rc-schedules.h +++ b/src/rc/rc-schedules.h @@ -18,7 +18,7 @@ void free_schedulelist(void); int parse_signal(const char *applet, const char *sig); void parse_schedule(const char *applet, const char *string, int timeout); int do_stop(const char *applet, const char *exec, const char *const *argv, - pid_t pid, uid_t uid,int sig, bool test); + pid_t pid, uid_t uid,int sig, bool test, bool quiet); int run_stop_schedule(const char *applet, const char *exec, const char *const *argv, pid_t pid, uid_t uid, diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index 46784b26..dab8b3b1 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -684,7 +684,7 @@ int main(int argc, char **argv) pid = 0; if (do_stop(applet, exec, (const char * const *)margv, pid, uid, - 0, test) > 0) + 0, test, false) > 0) eerrorx("%s: %s is already running", applet, exec); if (test) { @@ -964,7 +964,7 @@ int main(int argc, char **argv) } else pid = 0; if (do_stop(applet, exec, (const char *const *)margv, - pid, uid, 0, test) > 0) + pid, uid, 0, test, false) > 0) alive = true; } diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c index a702a25c..7b894e7b 100644 --- a/src/rc/supervise-daemon.c +++ b/src/rc/supervise-daemon.c @@ -440,11 +440,6 @@ int main(int argc, char **argv) applet = basename_c(argv[0]); atexit(cleanup); - signal_setup(SIGINT, handle_signal); - signal_setup(SIGQUIT, handle_signal); - signal_setup(SIGTERM, handle_signal); - openlog(applet, LOG_PID, LOG_DAEMON); - if ((tmp = getenv("SSD_NICELEVEL"))) if (sscanf(tmp, "%d", &nicelevel) != 1) eerror("%s: invalid nice level `%s' (SSD_NICELEVEL)", @@ -729,6 +724,8 @@ int main(int argc, char **argv) if (child_pid != 0) { /* this is the supervisor */ umask(numask); + openlog(applet, LOG_PID, LOG_DAEMON); + signal_setup(SIGTERM, handle_signal); fp = fopen(pidfile, "w"); if (! fp)