FreeBSD src
Go to file
Alan Somers c2090e73d7 Replace 4.4BSD Lite's unix domain socket backpressure hack with a cleaner
mechanism, based on the new SB_STOP sockbuf flag.  The old hack dynamically
changed the sending sockbuf's high water mark whenever adding or removing
data from the receiving sockbuf.  It worked for stream sockets, but it never
worked for SOCK_SEQPACKET sockets because of their atomic nature.  If the
sockbuf was partially full, it might return EMSGSIZE instead of blocking.

The new solution is based on DragonFlyBSD's fix from commit
3a6117bbe0ed6a87605c1e43e12a1438d8844380 on 2008-05-27.  It adds an SB_STOP
flag to sockbufs.  Whenever uipc_send surpasses the socket's size limit, it
sets SB_STOP on the sending sockbuf.  sbspace() will then return 0 for that
sockbuf, causing sosend_generic and friends to block.  uipc_rcvd will
likewise clear SB_STOP.  There are two fringe benefits: uipc_{send,rcvd} no
longer need to call chgsbsize() on every send and receive because they don't
change the sockbuf's high water mark.  Also, uipc_sense no longer needs to
acquire the UIPC linkage lock, because it's simpler to compute the
st_blksizes.

There is one drawback: since sbspace() will only ever return 0 or the
maximum, sosend_generic will allow the sockbuf to exceed its nominal maximum
size by at most one packet of size less than the max.  I don't think that's
a serious problem.  In fact, I'm not even positive that FreeBSD guarantees a
socket will always stay within its nominal size limit.

sys/sys/sockbuf.h
	Add the SB_STOP flag and adjust sbspace()

sys/sys/unpcb.h
	Delete the obsolete unp_cc and unp_mbcnt fields from struct unpcb.

sys/kern/uipc_usrreq.c
	Adjust uipc_rcvd, uipc_send, and uipc_sense to use the SB_STOP
	backpressure mechanism.  Removing obsolete unpcb fields from
	db_show_unpcb.

tests/sys/kern/unix_seqpacket_test.c
	Clear expected failures from ATF.

Obtained from:	DragonFly BSD
PR:		kern/185812
Reviewed by:	silence from freebsd-net@ and rwatson@
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corporation
2014-03-13 18:42:12 +00:00
bin sh: Successfully do nothing when killing a terminated job. 2014-03-08 19:44:34 +00:00
cddl cddl/contrib/opensolaris/lib/libuutil/common/uu_avl.c 2014-03-07 23:01:35 +00:00
contrib Garbage collect the old way of adding the libstdc++ include directories 2014-03-11 21:43:10 +00:00
crypto Fix installations that use kernels without CAPABILITIES support. 2014-02-04 21:48:09 +00:00
etc Add a mailer.conf example to use dma 2014-03-10 14:36:27 +00:00
games Correct a typo in Malcolm MacDougall's name. 2014-02-15 22:15:24 +00:00
gnu add support for building a cross-gdb for ARM... This isn't hooked up 2014-02-12 02:08:42 +00:00
include Update libucl to 2014-03-02 version which fixes an important bug when parsing empty arrays 2014-03-10 10:23:43 +00:00
kerberos5 Revert my commit in r261253; the real problem was tackled in r262209. 2014-02-20 20:53:29 +00:00
lib To avoid missing a chance to cancel thread, call _pthread_testcancel at the 2014-03-13 06:54:10 +00:00
libexec ttys(5): Pseudo-terminals are not listed and the network keyword is obsolete. 2014-03-09 22:38:11 +00:00
release Update board definition for WANDBOARD-QUAD to match crochet. 2014-03-09 02:00:48 +00:00
rescue - Trim an unused and bogus Makefile for mount_smbfs. 2013-06-28 21:00:08 +00:00
sbin Avoid segment fault when attempting to clean up cylinder group 2014-03-12 01:28:21 +00:00
secure Refresh our implementation of OpenBSD's Blowfish password format. 2014-02-25 23:03:48 +00:00
share remove link to the missing AMD Geode LX SB man page... we can add it 2014-03-13 16:19:36 +00:00
sys Replace 4.4BSD Lite's unix domain socket backpressure hack with a cleaner 2014-03-13 18:42:12 +00:00
tests Replace 4.4BSD Lite's unix domain socket backpressure hack with a cleaner 2014-03-13 18:42:12 +00:00
tools Since 32-bit if_baudrate isn't enough to describe a baud rate of a 10 Gbit 2014-03-13 03:42:24 +00:00
usr.bin Since 32-bit if_baudrate isn't enough to describe a baud rate of a 10 Gbit 2014-03-13 03:42:24 +00:00
usr.sbin Fix pw(8) deletion of group "username" on userdel even if group "username" 2014-03-13 18:16:42 +00:00
COPYRIGHT Bump copyright year. 2013-12-31 12:18:10 +00:00
LOCKS Explicitly require Security Officer's approval for kernel PRNG bits. 2013-09-17 14:19:05 +00:00
MAINTAINERS Explicitly request review/regression testing on the 2014-03-02 23:51:03 +00:00
Makefile Update libucl to 2014-03-02 version which fixes an important bug when parsing empty arrays 2014-03-10 10:23:43 +00:00
Makefile.inc1 Use ${MAKE} so that we always use the same version/implementation 2014-03-02 00:14:57 +00:00
ObsoleteFiles.inc Remove libyaml, it has been replaced by libucl 2014-02-23 22:27:14 +00:00
README Add the cddl/ directory. 2010-11-14 11:32:56 +00:00
UPDATING Disable libwrap (TCP wrappers) support in rpcbind by default, introducing 2014-03-06 17:33:27 +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 ``world''
target should only be used in cases where the source tree has not
changed from the currently running version.  See:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
for more information, including setting make(1) variables.

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.

cddl		Various commands and libraries under the Common Development
		and Distribution License.

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.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

rescue		Build system for statically linked /rescue utilities.

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