From owner-svn-src-user@freebsd.org  Thu Mar 22 12:01:31 2018
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE7E8F5F715
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Thu, 22 Mar 2018 12:01:30 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id A2E0A707DE;
 Thu, 22 Mar 2018 12:01:30 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DDCF11192;
 Thu, 22 Mar 2018 12:01:30 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2MC1U0O038517;
 Thu, 22 Mar 2018 12:01:30 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2MC1Ug6038516;
 Thu, 22 Mar 2018 12:01:30 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201803221201.w2MC1Ug6038516@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Thu, 22 Mar 2018 12:01:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r331354 - user/pho/stress2/misc
X-SVN-Group: user
X-SVN-Commit-Author: pho
X-SVN-Commit-Paths: user/pho/stress2/misc
X-SVN-Commit-Revision: 331354
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 22 Mar 2018 12:01:31 -0000

Author: pho
Date: Thu Mar 22 12:01:30 2018
New Revision: 331354
URL: https://svnweb.freebsd.org/changeset/base/331354

Log:
  Changed wait for child to run from 200us to 1s to suppress infrequent error
  message from killpg(2). Style fixes while here.
  
  Sponsored by:	Dell EMC Isilon

Modified:
  user/pho/stress2/misc/killpg.sh

Modified: user/pho/stress2/misc/killpg.sh
==============================================================================
--- user/pho/stress2/misc/killpg.sh	Thu Mar 22 11:57:59 2018	(r331353)
+++ user/pho/stress2/misc/killpg.sh	Thu Mar 22 12:01:30 2018	(r331354)
@@ -38,7 +38,7 @@
 here=`pwd`
 cd /tmp
 sed '1,/^EOF/d' < $here/$0 > killpg.c
-mycc -o killpg -Wall -Wextra killpg.c
+mycc -o killpg -Wall -Wextra killpg.c || exit 1
 rm -f killpg.c
 
 /tmp/killpg
@@ -47,6 +47,8 @@ rm -f /tmp/killpg
 exit 0
 EOF
 #include <sys/types.h>
+#include <sys/wait.h>
+
 #include <err.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -54,10 +56,9 @@ EOF
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/wait.h>
 #include <unistd.h>
 
-pid_t gid, pid;
+static pid_t gid, pid;
 
 #define LOOPS 100
 
@@ -66,7 +67,7 @@ hand(int i __unused) {	/* handler */
 	_exit(0);
 }
 
-void
+static void
 nlooper(void)
 {
 	int i;
@@ -85,7 +86,7 @@ nlooper(void)
 	_exit(0);
 }
 
-void
+static void
 looper(void)
 {
 	int i;
@@ -105,11 +106,10 @@ looper(void)
 	_exit(0);
 }
 
-void
+static void
 killer(void)
 {
 	struct passwd *pw;
-	int i;
 
 	setproctitle("killer");
 	if ((pw = getpwnam("nobody")) == NULL)
@@ -124,14 +124,8 @@ killer(void)
 	if ((gid = fork()) == 0)
 		nlooper();	/* nobody looper */
 
-	usleep(200);
-	i = 0;
-	for (;;) {
-		if (i++ > 1000) {
-			if (access("cont", R_OK) == -1)
-				break;
-			i = 0;
-		}
+	sleep(1);
+	while (access("cont", R_OK) == 0) {
 		if (killpg(gid, SIGINFO) == -1) {
 			if (errno == EPERM)
 				continue;