From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (unknown [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 A8245138334 for ; Sat, 6 Oct 2018 18:03:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 897EAE0A9F; Sat, 6 Oct 2018 18:03:17 +0000 (UTC) Received: from smtp.gentoo.org (dev.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 58095E0A9F for ; Sat, 6 Oct 2018 18:03:16 +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 E417F335CDD for ; Sat, 6 Oct 2018 18:03:08 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9D398433 for ; Sat, 6 Oct 2018 18:03:06 +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: <1538848264.eca4357892315ca7340bbfc2b373d7660a34142f.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/supervise-daemon.c X-VCS-Directories: src/rc/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: eca4357892315ca7340bbfc2b373d7660a34142f X-VCS-Branch: master Date: Sat, 6 Oct 2018 18:03:06 +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: d0fe95b0-b23a-4a3a-bde9-387c4df23e55 X-Archives-Hash: 01cba605046e8dc7b8e7c525e81847da commit: eca4357892315ca7340bbfc2b373d7660a34142f Author: William Hubbs gmail com> AuthorDate: Sat Oct 6 17:51:04 2018 +0000 Commit: William Hubbs gentoo org> CommitDate: Sat Oct 6 17:51:04 2018 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=eca43578 supervise-daemon: use nanosleep() instead of sleep() We will be using sigalrm in this process for health checking, and sigalrm cannot be used with sleep() safely. src/rc/supervise-daemon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c index 8d56b8d4..24cc56fa 100644 --- a/src/rc/supervise-daemon.c +++ b/src/rc/supervise-daemon.c @@ -425,6 +425,7 @@ static void supervisor(char *exec, char **argv) FILE *fp; int i; int nkilled; + struct timespec ts; time_t respawn_now= 0; time_t first_spawn= 0; @@ -497,7 +498,9 @@ static void supervisor(char *exec, char **argv) if (nkilled > 0) syslog(LOG_INFO, "killed %d processes", nkilled); } else { - sleep(respawn_delay); + ts.tv_sec = respawn_delay; + ts.tv_nsec = 0; + nanosleep(&ts, NULL); if (respawn_max > 0 && respawn_period > 0) { respawn_now = time(NULL); if (first_spawn == 0)