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 11AE8139070 for ; Fri, 18 May 2018 22:27:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0866CE08F5; Fri, 18 May 2018 22:27:52 +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 CB917E08F5 for ; Fri, 18 May 2018 22:27:51 +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 0E082335C60 for ; Fri, 18 May 2018 22:27:50 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6247C43 for ; Fri, 18 May 2018 22:27:48 +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: <1526680101.faa8318b3ba278544413a39d4a5ae4457711793f.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: src/includes/, src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/includes/rc-misc.h src/rc/do_service.c src/rc/rc-misc.c src/rc/rc-status.c X-VCS-Directories: src/includes/ src/rc/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: faa8318b3ba278544413a39d4a5ae4457711793f X-VCS-Branch: master Date: Fri, 18 May 2018 22:27:48 +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: 053cb037-afd2-4c85-9551-92fce43f0df3 X-Archives-Hash: f1b945f5911f25c285e197621a94084b commit: faa8318b3ba278544413a39d4a5ae4457711793f Author: William Hubbs gmail com> AuthorDate: Fri May 18 21:48:21 2018 +0000 Commit: William Hubbs gentoo org> CommitDate: Fri May 18 21:48:21 2018 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=faa8318b Remove the _rc_can_find_pids function This test to find if we could see pid 1 was being used inconsistently in rc-status and mark_service_crashed to decide whether we could test to see if the daemon for the service was crashed, and it was not part of the librc library. I am removing it from the executables because of inconsistent usage. I will add it to the library if it is needed there. src/includes/rc-misc.h | 3 --- src/rc/do_service.c | 4 +--- src/rc/rc-misc.c | 28 ---------------------------- src/rc/rc-status.c | 7 +------ 4 files changed, 2 insertions(+), 40 deletions(-) diff --git a/src/includes/rc-misc.h b/src/includes/rc-misc.h index e6789911..d05255f4 100644 --- a/src/includes/rc-misc.h +++ b/src/includes/rc-misc.h @@ -66,9 +66,6 @@ int parse_mode(mode_t *, char *); /* Handy function so we can wrap einfo around our deptree */ RC_DEPTREE *_rc_deptree_load (int, int *); -/* Test to see if we can see pid 1 or not */ -bool _rc_can_find_pids(void); - RC_SERVICE lookup_service_state(const char *service); void from_time_t(char *time_string, time_t tv); time_t to_time_t(char *timestring); diff --git a/src/rc/do_service.c b/src/rc/do_service.c index a36a09ca..5d78e8df 100644 --- a/src/rc/do_service.c +++ b/src/rc/do_service.c @@ -68,9 +68,7 @@ int main(int argc, char **argv) ok = rc_service_started_daemon(service, exec, NULL, idx); } else if (strcmp(applet, "service_crashed") == 0) { - ok = (_rc_can_find_pids() && - rc_service_daemons_crashed(service) && - errno != EACCES); + ok = ( rc_service_daemons_crashed(service) && errno != EACCES); } else eerrorx("%s: unknown applet", applet); diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c index 50c09747..e933409f 100644 --- a/src/rc/rc-misc.c +++ b/src/rc/rc-misc.c @@ -411,34 +411,6 @@ RC_DEPTREE * _rc_deptree_load(int force, int *regen) return rc_deptree_load(); } -bool _rc_can_find_pids(void) -{ - RC_PIDLIST *pids; - RC_PID *pid; - RC_PID *pid2; - bool retval = false; - - if (geteuid() == 0) - return true; - - /* If we cannot see process 1, then we don't test to see if - * services crashed or not */ - pids = rc_find_pids(NULL, NULL, 0, 1); - if (pids) { - pid = LIST_FIRST(pids); - if (pid) { - retval = true; - while (pid) { - pid2 = LIST_NEXT(pid, entries); - free(pid); - pid = pid2; - } - } - free(pids); - } - return retval; -} - static const struct { const char * const name; RC_SERVICE bit; diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c index d29f876a..ab80d901 100644 --- a/src/rc/rc-status.c +++ b/src/rc/rc-status.c @@ -54,7 +54,6 @@ const char *usagestring = "" \ "Usage: rc-status [options] ...\n" \ " or: rc-status [options] [-a | -c | -l | -m | -r | -s | -u]"; -static bool test_crashed = false; static RC_DEPTREE *deptree; static RC_STRINGLIST *types; @@ -145,9 +144,7 @@ print_service(const char *service) color = ECOLOR_WARN; } else if (state & RC_SERVICE_STARTED) { errno = 0; - if (test_crashed && - rc_service_daemons_crashed(service) && - errno != EACCES) + if (rc_service_daemons_crashed(service) && errno != EACCES) { child_pid = rc_service_value_get(service, "child_pid"); start_time = rc_service_value_get(service, "start_time"); @@ -240,8 +237,6 @@ int main(int argc, char **argv) char *p, *runlevel = NULL; int opt, retval = 0; - test_crashed = _rc_can_find_pids(); - applet = basename_c(argv[0]); while ((opt = getopt_long(argc, argv, getoptstring, longopts, (int *) 0)) != -1)