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 87B491396D0 for ; Fri, 25 Aug 2017 16:48:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DCE6C1FC002; Fri, 25 Aug 2017 16:48:54 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 BE5661FC002 for ; Fri, 25 Aug 2017 16:48:53 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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 DEAE134071C for ; Fri, 25 Aug 2017 16:48:52 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3C9D78250 for ; Fri, 25 Aug 2017 16:48:51 +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: <1503679005.36a0ab9054512ade413226fb8e8b28060045e9a4.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 X-VCS-Directories: src/rc/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 36a0ab9054512ade413226fb8e8b28060045e9a4 X-VCS-Branch: master Date: Fri, 25 Aug 2017 16:48:51 +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: 42a706bc-7bbf-4f98-ac84-76b6d6f7844c X-Archives-Hash: 1265463a7ff09ef6d12dbfcde018b80e commit: 36a0ab9054512ade413226fb8e8b28060045e9a4 Author: William Hubbs gmail com> AuthorDate: Fri Aug 25 16:36:45 2017 +0000 Commit: William Hubbs gentoo org> CommitDate: Fri Aug 25 16:36:45 2017 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=36a0ab90 make run_stop_schedule accept a pid instead of a pid file src/rc/rc-schedules.c | 13 +++---------- src/rc/rc-schedules.h | 2 +- src/rc/start-stop-daemon.c | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/rc/rc-schedules.c b/src/rc/rc-schedules.c index 0390ef9c..7eb28372 100644 --- a/src/rc/rc-schedules.c +++ b/src/rc/rc-schedules.c @@ -297,7 +297,7 @@ int do_stop(const char *applet, const char *exec, const char *const *argv, int run_stop_schedule(const char *applet, const char *exec, const char *const *argv, - const char *pidfile, uid_t uid, + pid_t pid, uid_t uid, bool test, bool progress) { SCHEDULEITEM *item = TAILQ_FIRST(&schedule); @@ -306,14 +306,13 @@ int run_stop_schedule(const char *applet, int nrunning = 0; long nloops, nsecs; struct timespec ts; - pid_t pid = 0; const char *const *p; bool progressed = false; if (exec) einfov("Will stop %s", exec); - if (pidfile) - einfov("Will stop PID in pidfile `%s'", pidfile); + if (pid > 0) + einfov("Will stop PID %d", pid); if (uid) einfov("Will stop processes owned by UID %d", uid); if (argv && *argv) { @@ -328,12 +327,6 @@ int run_stop_schedule(const char *applet, } } - if (pidfile) { - pid = get_pid(applet, pidfile); - if (pid == -1) - return 0; - } - while (item) { switch (item->type) { case SC_GOTO: diff --git a/src/rc/rc-schedules.h b/src/rc/rc-schedules.h index 6bed7916..0a10b381 100644 --- a/src/rc/rc-schedules.h +++ b/src/rc/rc-schedules.h @@ -21,7 +21,7 @@ int do_stop(const char *applet, const char *exec, const char *const *argv, pid_t pid, uid_t uid,int sig, bool test); int run_stop_schedule(const char *applet, const char *exec, const char *const *argv, - const char *pidfile, uid_t uid, + pid_t pid, uid_t uid, bool test, bool progress); #endif diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index df5b3184..4cda6102 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -657,7 +657,7 @@ int main(int argc, char **argv) else parse_schedule(applet, NULL, sig); i = run_stop_schedule(applet, exec, (const char *const *)margv, - pidfile, uid, test, progress); + get_pid(applet, pidfile), uid, test, progress); if (i < 0) /* We failed to stop something */