History log of /freebsd-current/bin/sh/jobs.h
Revision Date Author Comments
# 90aea514 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 42b38843 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .h pattern

Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/


# 10297a9e 28-Sep-2022 John Baldwin <jhb@FreeBSD.org>

sh: Fix mismatch in array bounds for vforkexecshell().

Reviewed by: imp, jilles, emaste
Reported by: GCC -Warray-parameter
Differential Revision: https://reviews.freebsd.org/D36760


# b0125116 01-Jan-2018 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Move various structs from jobs.h to jobs.c

These implementation details of jobs.c need not be exposed.


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# b823fb59 02-Sep-2013 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Fix race condition with signals and wait or set -T.

The change in r238888 was incomplete. It was still possible for a trapped
signal to arrive before the shell went to sleep (sigsuspend()) because a
check was missing or because the signal arrived before in_waitcmd was set.

On SMP, this bug sometimes caused the builtins/wait4.0 test to take 1 second
to execute; it then might or might not fail. On UP, the test almost always
failed.


# 184dcee2 15-Jul-2012 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Remove unused variable in_dowait.


# caf29fab 04-Feb-2012 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Use vfork in a few common cases.

This uses vfork() for simple commands and command substitutions containing a
single simple command, invoking an external program under certain conditions
(no redirections or variable assignments, non-interactive shell, no job
control). These restrictions limit the amount of code executed in a vforked
child.

There is a large speedup (for example 35%) in microbenchmarks. The
difference in buildkernel is smaller (for example 0.5%) but still
statistically significant. See
http://lists.freebsd.org/pipermail/freebsd-hackers/2012-January/037581.html
for some numbers.

The use of vfork() can be disabled by setting a variable named
SH_DISABLE_VFORK.


# 454a02b3 13-Jun-2011 Jilles Tjoelker <jilles@FreeBSD.org>

sh: Fix duplicate prototypes for builtins.

Have mkbuiltins write the prototypes for the *cmd functions to builtins.h
instead of builtins.c and include builtins.h in more .c files instead of
duplicating prototypes for *cmd functions in other headers.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# ed4c3b5f 29-Jun-2010 Jilles Tjoelker <jilles@FreeBSD.org>

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


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# de37e41c 07-Oct-2006 Stefan Farfeleder <stefanf@FreeBSD.org>

Add the POSIX option -p to the jobs builtin command. It prints the PID of the
process leader for each job. Now the last specified option for the output
format (-l, -p or -s) wins, previously -s trumped -l.

PR: 99926
Submitted by: Ed Schouten and novel (patches modified by me)


# 6195fb41 06-Apr-2004 Mark Murray <markm@FreeBSD.org>

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


# b80be282 18-Jul-2002 Tim J. Robbins <tjr@FreeBSD.org>

Avoid using ints or shorts to store process id's, use pid_t instead.
The pgrp member of struct job was declared as a short and could not store
every possible process group ID value, the rest of them were benign because
pid_t happens to be an int.


# f1ae2c66 18-Jul-2002 Tim J. Robbins <tjr@FreeBSD.org>

Make the message that is printed when the foreground process is terminated
by a signal the same as pdksh/bash/sh before rev. 1.34.


# ad8a0759 31-May-2002 Tim J. Robbins <tjr@FreeBSD.org>

Add -s (output PID's only) and -l (show PID's) options to the jobs(1)
builtin. Modify the output format to match what SUSv3 requires.


# d86825be 30-May-2002 Tim J. Robbins <tjr@FreeBSD.org>

Instead of keeping just the jobid of the most recently bg'd or fg'd job,
keep a linked list of the jobs, most recently used first. This is required
to support the idea of `previous job', and to allow the jobs fg and bg
default to be correct according to POSIX.


# 5134c3f7 01-Feb-2002 Warner Losh <imp@FreeBSD.org>

o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
they already are.
o Change
int
foo() {
...
to
int
foo(void)
{
...


# 2a456239 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 57b2932a 21-Apr-1999 Martin Cracauer <cracauer@FreeBSD.org>

Next approach to make loops in interactive interruptable.

PR: bin/9173


# 9bbfa415 10-Sep-1998 Martin Cracauer <cracauer@FreeBSD.org>

Narrow down conditions to break wait() to process traps.
Improve comments.


# 135421dd 08-Sep-1998 Martin Cracauer <cracauer@FreeBSD.org>

If traps are set, they are now executed even when a signal-blocking
foreground child is running. Formerly, traps were exceuted after the
next child exit.

The enables the user to put a breaking wrapper around a blocking
application:
(trap 'echo trap ; exit 1' 2; ./pestyblocker; echo -n)

The "echo -n" after the child call is needed to prevent sh from
optimizing the trap-executing shell away. I'm working on this.


# 1f40b47b 25-Aug-1998 Martin Cracauer <cracauer@FreeBSD.org>

Improve bookkeeping of in_waitcmd and style fixes.
Submitted by: Bruce Evans


# 7a8e920b 24-Aug-1998 Martin Cracauer <cracauer@FreeBSD.org>

Do not exit on SIGINT in non-interactive shells, fixes PR 1206,
i.e. this makes emacs usable from system(3). Programs called from
shellscripts are now required to exit with proper signal status. That
means, they have to kill themself. Exiting with faked numerical exit
code is not sufficient.

Exit with proper signal status if script exits on signal.

Make the wait builtin interruptable, both with and without traps set.

Use volatile sig_atomic_t where (and only where) appropriate.

(Almost) fix printing of newlines on SIGINT.

Make traps setable from trap handlers. This is needed for shellscripts
that catch SIGINT for cleanup work but intend to exit on it, hance
have to kill themself from a trap handler. I.e. mkdep.

While I'm at it, make it -Wall clean. -Wall is not enabled in
Makefile, since vararg warnx() macro calls in usr.bin/printf/printf.c
are not -Wall-able.
PR: 1206
Obtained from: Basic SIGINT fix from Bruce Evans


# ead152eb 17-Aug-1997 Steve Price <steve@FreeBSD.org>

Make all status values an integral type and use
pid_t when referring to process IDs.


# b97fa2ef 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# aa9caaf6 01-Sep-1996 Peter Wemm <peter@FreeBSD.org>

Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is a
merge of parallel duplicate work by Steve Price and myself. :-]

There are some changes to the build that are my fault... mkinit.c was
trying (poorly) to duplicate some of the work that make(1) is designed to
do. The Makefile hackery is my fault too, the depend list was incomplete
because of some explicit OBJS+= entries, so mkdep wasn't picking up their
source file #includes.

This closes a pile of /bin/sh PR's, but not all of them..

Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter


# 069428af 26-May-1996 Peter Wemm <peter@FreeBSD.org>

Import the 4.4BSD-Lite2 /bin/sh sources

Requested by: joerg

(Note, this is mostly going to be conflicts, which is expected. Our entire
sh source has a mainline, so this should not change anything except for
a few new files appearing. I dont think they are a problem)


# 89730b29 23-Sep-1994 David Greenman <dg@FreeBSD.org>

Added $Id$


# 4b88c807 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite bin Sources