FreeBSD src
Go to file
David Xu 35c32a76f9 In the kernel code, we have the tsleep() call with the PCATCH argument.
PCATCH means 'if we get a signal, interrupt me!" and tsleep returns
either EINTR or ERESTART depending on the circumstances.  ERESTART is
"special" because it causes the system call to fail, but right as it
returns back to userland it tells the trap handler to move %eip back a
bit so that userland will immediately re-run the syscall.
This is a syscall restart. It only works for things like read() etc where
nothing has changed yet. Note that *userland* is tricked into restarting
the syscall by the kernel. The kernel doesn't actually do the restart. It
is deadly for things like select, poll, nanosleep etc where it might cause
the elapsed time to be reset and start again from scratch.  So those
syscalls do this to prevent userland rerunning the syscall:
  if (error == ERESTART) error = EINTR;

Fake "signals" like SIGTSTP from ^Z etc do not normally invoke userland
signal handlers. But, in -current, the PCATCH *is* being triggered and
tsleep is returning ERESTART, and the syscall is aborted even though no
userland signal handler was run.
That is the fault here.  We're triggering the PCATCH in cases that we
shouldn't.  ie: it is being triggered on *any* signal processing, rather
than the case where the signal is posted to userland.
	--- Peter

The work of psignal() is a patchwork of special case required by the process
debugging and job-control facilities...
	--- Kirk McKusick
	"The design and impelementation of the 4.4BSD Operating system"
	Page 105

in STABLE source, when psignal is posting a STOP signal to sleeping
process and the signal action of the process is SIG_DFL, system will
directly change the process state from SSLEEP to SSTOP, and when
SIGCONT is posted to the stopped process, if it finds that the process
is still on sleep queue, the process state will be restored to SSLEEP,
and won't wakeup the process.

this commit mimics the behaviour in STABLE source tree.

Reviewed by: Jon Mini, Tim Robbins, Peter Wemm
Approved by: julian@freebsd.org (mentor)
2002-09-03 12:56:01 +00:00
bin Prevent ps(1) from doing idiotic munging of things in a -ofmt= string. 2002-09-03 05:44:00 +00:00
contrib Fix a cvs server bug introduced in 1.11.2, in the words of the author: 2002-09-02 07:58:04 +00:00
crypto Pass the pointy hat! Remove accidently imported files. 2002-08-30 21:53:25 +00:00
etc We don't use single_mountd_enable anymore. It's just mountd_enable. I must 2002-09-02 21:20:58 +00:00
games Spell Ken Olsen's name the same way everywhere. 2002-08-31 23:15:41 +00:00
gnu cvs-1.11.2 seems to bug out if HAVE_MMAP is not defined. It hoses its 2002-09-02 11:35:13 +00:00
include Now that _BSD_CLK_TCK_ and _BSD_CLOCKS_PER_SEC_ are the same on all 2002-09-03 00:06:58 +00:00
kerberos5 = The prefix should be /usr', not /'. 2002-09-01 14:45:17 +00:00
kerberosIV Drop support for COPY, -c has been the default mode of install(1) 2002-07-29 09:40:17 +00:00
lib Fix a nasty bug exposed by mktime() when time_t is significantly bigger 2002-09-03 04:34:10 +00:00
libexec Was mising ftpchroot.5 2002-08-30 06:50:08 +00:00
release Modified release notes: Remote note about enabling rnNG (it's now on 2002-09-03 01:07:32 +00:00
sbin use 'file system superblock' for the error message. This will match other 2002-08-31 21:34:54 +00:00
secure Use uint32_t' instead of unsigned long', since the code assumes 32-bit 2002-08-24 02:53:23 +00:00
share Fix a few typos and nits. 2002-09-01 22:07:24 +00:00
sys In the kernel code, we have the tsleep() call with the PCATCH argument. 2002-09-03 12:56:01 +00:00
tools Add regression tests for sysvipc. 2002-08-15 06:34:37 +00:00
usr.bin Suggest -p instead of -o /dev/stdout. 2002-09-03 10:18:56 +00:00
usr.sbin When installing package from a local file assume that all subsequent 2002-09-03 06:59:33 +00:00
COPYRIGHT
MAINTAINERS Point at myself for reviews on commits to the MAC Framework and 2002-09-01 15:55:38 +00:00
Makefile Deal with bootstrapping from an old -current (almost exactly a year old) 2002-08-31 07:18:40 +00:00
Makefile.inc1 Similar to bsd.subdir.mk, echo the name of the dir before 2002-08-23 12:49:16 +00:00
Makefile.upgrade
README Fix broken handbook links. 2002-07-21 16:45:30 +00:00
UPDATING gcc 3.2 2002-09-03 06:13:43 +00:00

This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree, the most
commonly used one being ``world'', which rebuilds and installs
everything in the FreeBSD system from the source tree except the
kernel, the kernel-modules and the contents of /etc.  The
``buildkernel'' and ``installkernel'' targets build and install
the kernel and the modules (see below).  Please see the top of
the Makefile in this directory for more information on the
standard build targets and compile-time flags.

Building a kernel is a somewhat more involved process, documentation
for which can be found at:
   http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
And in the config(8) man page.
Note: If you want to build and install the kernel with the
``buildkernel'' and ``installkernel'' targets, you might need to build
world before.  More information is available in the handbook.

The sample kernel configuration files reside in the sys/<arch>/conf
sub-directory (assuming that you've installed the kernel sources), the
file named GENERIC being the one used to build your initial installation
kernel.  The file NOTES contains entries and documentation for all possible
devices, not just those commonly used.  It is the successor of the ancient
LINT file, but in contrast to LINT, it is not buildable as a kernel but a
pure reference and documentation file.


Source Roadmap:
---------------
bin		System/user commands.

contrib		Packages contributed by 3rd parties.

crypto		Cryptography stuff (see crypto/README).

etc		Template files for /etc.

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberos5	Kerberos5 (Heimdal) package.

kerberosIV	KerberosIV (eBones) package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

sbin		System commands.

secure		Cryptographic libraries and commands.

share		Shared resources.

sys		Kernel sources.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/synching.html