FreeBSD src
Go to file
Pawel Jakub Dawidek af71f40a98 Add a little, but very useful script for use with programs that work using an
event loop and should sleep only when waiting for events (eg. via kevent(2)).
When a program is going to sleep in the kernel, the script will show its name,
PID, kernel stack trace and userland stack trace. Sleeping in kevent(2) is
ignored as it is expected to be valid.

Sample output:

# ./blocking lynxd

lynxd(15042) is blocking...

              kernel`_cv_wait_sig+0x124
              kernel`seltdwait+0xae
              kernel`sys_poll+0x3a3
              kernel`amd64_syscall+0x343
              kernel`0xffffffff806c79ab

              lynxd`poll+0xa
              lynxd`pqSocketCheck+0xa2
              lynxd`pqWaitTimed+0x29
              lynxd`connectDBComplete+0xd7
              lynxd`PQsetdbLogin+0x2ec
              lynxd`db_connect+0x3c
              lynxd`main+0x198
              lynxd`_start+0x16f
              0x2

lynxd(1925) is blocking...

              kernel`_cv_wait+0x125
              zfs.ko`zio_wait+0x5b
              zfs.ko`dmu_buf_hold_array_by_dnode+0x1dc
              zfs.ko`dmu_read+0xcb
              zfs.ko`zfs_freebsd_getpages+0x37b
              kernel`VOP_GETPAGES_APV+0xa7
              kernel`vnode_pager_getpages+0x9a
              kernel`vm_fault_hold+0x885
              kernel`vm_fault+0x77
              kernel`trap_pfault+0x211
              kernel`trap+0x506
              kernel`0xffffffff806c76c2

              lynxd`EVP_add_cipher+0x13
              lynxd`SSL_library_init+0x11
              lynxd`main+0x94
              lynxd`_start+0x16f
              0x2

lynxd(1925) is blocking...

              kernel`_cv_wait+0x125
              zfs.ko`zio_wait+0x5b
              zfs.ko`dbuf_read+0x791
              zfs.ko`dbuf_findbp+0x12f
              zfs.ko`dbuf_hold_impl+0xa2
              zfs.ko`dbuf_hold+0x1b
              zfs.ko`dmu_buf_hold_array_by_dnode+0x153
              zfs.ko`dmu_read_uio+0x66
              zfs.ko`zfs_freebsd_read+0x3a3
              kernel`VOP_READ_APV+0xa1
              kernel`vn_read+0x13a
              kernel`vn_io_fault+0x10b
              kernel`dofileread+0x95
              kernel`kern_readv+0x68
              kernel`sys_read+0x63
              kernel`amd64_syscall+0x343
              kernel`0xffffffff806c79ab

              lynxd`_read+0xa
              lynxd`__srefill+0x122
              lynxd`fgets+0x78
              lynxd`file_gets+0x1d
              lynxd`BIO_gets+0x64
              lynxd`PEM_read_bio+0xf5
              lynxd`PEM_X509_INFO_read_bio+0x90
              lynxd`X509_load_cert_crl_file+0x47
              lynxd`by_file_ctrl+0x2e
              lynxd`X509_STORE_load_locations+0x4a
              lynxd`sslctx_init+0x255
              lynxd`main+0x215
              lynxd`_start+0x16f
              0x2

Requested by:	gnn
Obtained from:	Wheel Systems http://wheelsystems.com
2015-10-04 00:40:12 +00:00
bin Make GCC happy 2015-10-03 20:24:23 +00:00
cddl Have lockstat(1) trace locks by name rather than by address. 2015-09-30 05:46:56 +00:00
contrib Pass 8 arguments to makecontext on arm64 as this is all we support. 2015-10-01 09:53:12 +00:00
crypto Fix OpenSSH multiple vulnerabilities by backporting three changes 2015-08-25 20:48:37 +00:00
etc Update the arm64 ttys file to enable the correct uart based on which device 2015-10-01 09:36:18 +00:00
gnu Replace most of the beforeinstall: hack with FILES mechanism. 2015-09-30 20:47:27 +00:00
include Mute this cookie as well 2015-10-03 17:28:46 +00:00
kerberos5 Add more SUBDIR_PARALLEL. 2015-09-26 14:13:51 +00:00
lib Revert r288628 and instead fix a discrepancy between the posix_fadvise(2) 2015-10-03 22:27:14 +00:00
libexec Annotate arm userspace assembler sources stating their tolerance to 2015-09-29 16:09:58 +00:00
release Fix the path to the correct u-boot.bin file to write to 2015-10-01 19:48:10 +00:00
rescue META_MODE: Remove DEP_MACHINE from Makefile.depend files. 2015-09-25 19:44:01 +00:00
sbin Fix possible segmentation fault. 2015-10-03 03:12:57 +00:00
secure Replace afterinstall: hack from r111083 with 'make delete-old' functionality. 2015-09-19 03:46:10 +00:00
share Add a little, but very useful script for use with programs that work using an 2015-10-04 00:40:12 +00:00
sys net80211: reduce code duplication in the ieee80211_ioctl_setwmeparam() + fix comments. 2015-10-03 22:38:08 +00:00
targets All the games moved to usr.bin/ in r288485. 2015-10-02 17:58:16 +00:00
tests Use _exit() instead of exit() in child processes created during tests. 2015-09-09 22:54:07 +00:00
tools remove unused sgsmsg utility (originally imported from opensolaris) 2015-09-28 12:38:57 +00:00
usr.bin Style fix. 2015-10-03 19:08:36 +00:00
usr.sbin Fix post-test typo that snuck in. 2015-10-02 22:05:51 +00:00
.arcconfig Add repository.callsign, to help arcanist figure out what repo it's 2015-07-02 22:23:52 +00:00
.arclint phabricator related changes: 2015-04-20 20:33:22 +00:00
COPYRIGHT Bump copyright year. 2014-12-31 10:00:43 +00:00
LOCKS Explicitly require Security Officer's approval for kernel PRNG bits. 2013-09-17 14:19:05 +00:00
MAINTAINERS Remove cokane@ from MAINTAINERS for 3dfx(4)/tdfx(4) because their email 2014-11-25 05:25:12 +00:00
Makefile Fix the .MAKE added in r251750 to properly support the historical -n -n. 2015-09-29 18:57:30 +00:00
Makefile.inc1 Final step of eliminating the "games" distribution: Merge src/games 2015-10-02 10:08:11 +00:00
ObsoleteFiles.inc remove unused sgsmsg utility (originally imported from opensolaris) 2015-09-28 12:38:57 +00:00
README README: changes and fixups 2015-04-19 07:16:44 +00:00
UPDATING Correct UPDATING entry date 2015-09-24 16:56:44 +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.  See build(7)
and 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.  See build(7), config(8),
and http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
for more information.

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 kernel configuration files reside in the sys/<arch>/conf
sub-directory.  GENERIC is the default configuration used in release builds.
NOTES contains entries and documentation for all possible
devices, not just those commonly used.


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.

tests		Regression tests which can be run by Kyua.  See tests/README
		for additional information.

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