svn commit: r256735 - head/bin/sh
Jilles Tjoelker
jilles at FreeBSD.org
Fri Oct 18 12:35:12 UTC 2013
Author: jilles
Date: Fri Oct 18 12:35:12 2013
New Revision: 256735
URL: http://svnweb.freebsd.org/changeset/base/256735
Log:
sh: Remove one syscall when waiting for a foreground job.
The getpgrp() call is unnecessary: if there is no job control then the
result was not used at all and if there is job control then we are not a
subshell and our process group ID is equal to our process ID (rootpid).
Modified:
head/bin/sh/jobs.c
Modified: head/bin/sh/jobs.c
==============================================================================
--- head/bin/sh/jobs.c Fri Oct 18 12:31:32 2013 (r256734)
+++ head/bin/sh/jobs.c Fri Oct 18 12:35:12 2013 (r256735)
@@ -978,7 +978,6 @@ int
waitforjob(struct job *jp, int *origstatus)
{
#if JOBS
- pid_t mypgrp = getpgrp();
int propagate_int = jp->jobctl && jp->foreground;
#endif
int status;
@@ -992,7 +991,7 @@ waitforjob(struct job *jp, int *origstat
dotrap();
#if JOBS
if (jp->jobctl) {
- if (tcsetpgrp(ttyfd, mypgrp) < 0)
+ if (tcsetpgrp(ttyfd, rootpid) < 0)
error("tcsetpgrp failed, errno=%d\n", errno);
}
if (jp->state == JOBSTOPPED)
More information about the svn-src-head
mailing list