freebsd-dev/bin
Jilles Tjoelker ed4c3b5f86 sh: Forget about terminated background processes sooner.
Unless $! has been referenced for a particular job or $! still contains that
job's pid, forget about it after it has terminated. If $! has been
referenced, remember the job until the wait builtin has reported its
completion (either with the pid as parameter or without parameters).

In interactive mode, jobs are forgotten after termination has been reported,
which happens before primary prompts and through the jobs builtin. Even
then, though, remember a job if $! has been referenced.

This is similar to what is suggested by POSIX and should fix most memory
leaks (which also tend to cause sh to use more CPU time) with long running
scripts that start background jobs.

Caveats:
* Repeatedly referencing $! without ever doing 'wait', like
    while :; do foo & echo started foo: $!; sleep 60; done
  will still use a lot of memory and CPU time in the long run.
* The jobs and jobid builtins do not cause a job to be remembered for longer
  like expanding $! does.

PR:		bin/55346
2010-06-29 22:37:45 +00:00
..
cat Removed redundant WARNS setting. 2009-10-15 18:17:29 +00:00
chflags Staticify internal routines. 2009-06-23 23:30:56 +00:00
chio Zero struct before reading from it 2010-06-02 09:34:41 +00:00
chmod - Don't include both <sys/types.h> and <sys/param.h> 2009-09-02 05:26:59 +00:00
cp Don't try to copy a socket after "xxx is a socket (not copied)." message. 2010-06-05 08:50:39 +00:00
csh Let csh(1) use utmpx instead of utmp. 2010-01-13 17:49:35 +00:00
date Explain that setting an absolute day value can fail and that the month should 2010-06-04 06:56:58 +00:00
dd
df Staticify internal routines. 2009-06-23 23:30:56 +00:00
domainname
echo
ed ed(1): make WARNS=6 clean 2010-03-04 16:08:01 +00:00
expr
getfacl More mdoc nitpicking to improve compatibility to mdocml 2010-06-11 06:04:07 +00:00
hostname Staticify internal routines. 2009-06-23 23:30:56 +00:00
kenv Add missing `void' for function without arguments. 2009-12-29 08:45:07 +00:00
kill Do not restrict the allowed signals that can be specified by number 2010-02-25 13:53:09 +00:00
ln symlink(7): Add lpathconf(2) and *at system calls. 2010-04-25 13:29:59 +00:00
ls Change all our own code to use st_*tim instead of st_*timespec. 2010-03-28 13:16:08 +00:00
mkdir
mv Add NFSv4 ACL support to mv(1). 2009-09-04 21:49:37 +00:00
pax Fix back references in substitute command for pax(1) 2010-05-24 06:33:14 +00:00
pkill Recognise the -l switch with pkill - list kill command(s) used. 2010-06-20 08:48:30 +00:00
ps Update the list of the process flags for P_WKILLED. 2010-04-13 08:54:53 +00:00
pwait mdoc: order prologue macros consistently by Dd/Dt/Os 2010-04-14 19:08:06 +00:00
pwd
rcp Change all our own code to use st_*tim instead of st_*timespec. 2010-03-28 13:16:08 +00:00
realpath
rm
rmail Bump WARNS where possible. 2010-02-15 14:07:40 +00:00
rmdir
setfacl Update authors and history. 2010-05-13 16:46:23 +00:00
sh sh: Forget about terminated background processes sooner. 2010-06-29 22:37:45 +00:00
sleep
stty
sync
test Change all our own code to use st_*tim instead of st_*timespec. 2010-03-28 13:16:08 +00:00
uuidgen Removed redundant WARNS setting. 2009-10-15 18:17:29 +00:00
Makefile Add pwait utility, which waits for any process to terminate. 2009-11-17 22:47:20 +00:00
Makefile.inc