summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2012-07-28 14:56:50 +0000
committerjilles <jilles@FreeBSD.org>2012-07-28 14:56:50 +0000
commitacf68e5eb413ab998079634681a88d35a8a0ff37 (patch)
tree4d1769364f6d88accd0433ee40f5492b93a42d5b /bin
parentd73fbcf11700105c24f4b9ce3fe3cbc2886030f7 (diff)
downloadFreeBSD-src-acf68e5eb413ab998079634681a88d35a8a0ff37.zip
FreeBSD-src-acf68e5eb413ab998079634681a88d35a8a0ff37.tar.gz
sh: Inline waitproc() into its only caller.
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/jobs.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
index 41bd909..feb9e1f 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -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;
OpenPOWER on IntegriCloud