Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Jul 2012 14:56:50 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r238866 - head/bin/sh
Message-ID:  <201207281456.q6SEuofL037638@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sat Jul 28 14:56:50 2012
New Revision: 238866
URL: http://svn.freebsd.org/changeset/base/238866

Log:
  sh: Inline waitproc() into its only caller.

Modified:
  head/bin/sh/jobs.c

Modified: head/bin/sh/jobs.c
==============================================================================
--- head/bin/sh/jobs.c	Sat Jul 28 14:32:55 2012	(r238865)
+++ head/bin/sh/jobs.c	Sat Jul 28 14:56:50 2012	(r238866)
@@ -94,7 +94,6 @@ static void freejob(struct job *);
 static struct job *getjob(char *);
 pid_t getjobpgrp(char *);
 static pid_t dowait(int, struct job *);
-static pid_t waitproc(int, int *);
 static void checkzombies(void);
 static void cmdtxt(union node *);
 static void cmdputs(const char *);
@@ -1021,10 +1020,18 @@ dowait(int block, struct job *job)
 	int stopped;
 	int sig;
 	int coredump;
+	int wflags;
 
 	TRACE(("dowait(%d) called\n", block));
 	do {
-		pid = waitproc(block, &status);
+#if JOBS
+		wflags = WUNTRACED | WCONTINUED;
+#else
+		wflags = 0;
+#endif
+		if (block == 0)
+			wflags |= WNOHANG;
+		pid = wait3(&status, wflags, (struct rusage *)NULL);
 		TRACE(("wait returns %d, status=%d\n", (int)pid, status));
 	} while ((pid == -1 && errno == EINTR && breakwaitcmd == 0) ||
 		 (pid > 0 && (WIFSTOPPED(status) || WIFCONTINUED(status)) &&
@@ -1113,26 +1120,6 @@ dowait(int block, struct job *job)
 
 
 /*
- * Do a wait system call.  If job control is compiled in, we accept
- * stopped processes.  If block is zero, we return a value of zero
- * rather than blocking.
- */
-static pid_t
-waitproc(int block, int *status)
-{
-	int flags;
-
-#if JOBS
-	flags = WUNTRACED | WCONTINUED;
-#else
-	flags = 0;
-#endif
-	if (block == 0)
-		flags |= WNOHANG;
-	return wait3(status, flags, (struct rusage *)NULL);
-}
-
-/*
  * return 1 if there are stopped jobs, otherwise 0
  */
 int job_warning = 0;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207281456.q6SEuofL037638>