Commit Graph

307 Commits

Author SHA1 Message Date
Andrew Thompson
b84a4e0cf2 Link the defunct MUTEX_PROFILING option to LOCK_PROFILING. 2007-05-13 22:56:58 +00:00
Maxim Konovalov
8ad9c32345 o Document vdropl(9) [1].
o Add an MLINK for vdropl().

Reviewed by:	des [1]
Obtained from:	wording from vgone(9)
2007-04-01 09:48:59 +00:00
John Baldwin
4e7f640dfb Optimize sx locks to use simple atomic operations for the common cases of
obtaining and releasing shared and exclusive locks.  The algorithms for
manipulating the lock cookie are very similar to that rwlocks.  This patch
also adds support for exclusive locks using the same algorithm as mutexes.

A new sx_init_flags() function has been added so that optional flags can be
specified to alter a given locks behavior.  The flags include SX_DUPOK,
SX_NOWITNESS, SX_NOPROFILE, and SX_QUITE which are all identical in nature
to the similar flags for mutexes.

Adaptive spinning on select locks may be enabled by enabling the
ADAPTIVE_SX kernel option.  Only locks initialized with the SX_ADAPTIVESPIN
flag via sx_init_flags() will adaptively spin.

The common cases for sx_slock(), sx_sunlock(), sx_xlock(), and sx_xunlock()
are now performed inline in non-debug kernels.  As a result, <sys/sx.h> now
requires <sys/lock.h> to be included prior to <sys/sx.h>.

The new kernel option SX_NOINLINE can be used to disable the aforementioned
inlining in non-debug kernels.

The size of struct sx has changed, so the kernel ABI is probably greatly
disturbed.

MFC after:	1 month
Submitted by:	attilio
Tested by:	kris, pjd
2007-03-31 23:23:42 +00:00
Julian Elischer
27c20cc4b8 Connect the locking man page to the build.
Next step is to add it as a "See Also" to related man pages.
2007-03-30 17:56:19 +00:00
Maxim Konovalov
1f43095400 o Trim unneeded backslash. 2007-03-28 04:43:55 +00:00
Maxim Konovalov
dd3c9f51e5 o Actually add MLINKs for priv(9) functions. 2007-03-28 04:41:50 +00:00
Christian Brueffer
09dfbddbda Add MLINKs for priv(9) functions. 2007-03-27 21:20:57 +00:00
John Baldwin
e7573e7ad7 Allow threads to atomically release rw and sx locks while waiting for an
event.  Locking primitives that support this (mtx, rw, and sx) now each
include their own foo_sleep() routine.
- Rename msleep() to _sleep() and change it's 'struct mtx' object to a
  'struct lock_object' pointer.  _sleep() uses the recently added
  lc_unlock() and lc_lock() function pointers for the lock class of the
  specified lock to release the lock while the thread is suspended.
- Add wrappers around _sleep() for mutexes (mtx_sleep()), rw locks
  (rw_sleep()), and sx locks (sx_sleep()).  msleep() still exists and
  is now identical to mtx_sleep(), but it is deprecated.
- Rename SLEEPQ_MSLEEP to SLEEPQ_SLEEP.
- Rewrite much of sleep.9 to not be msleep(9) centric.
- Flesh out the 'RETURN VALUES' section in sleep.9 and add an 'ERRORS'
  section.
- Add __nonnull(1) to _sleep() and msleep_spin() so that the compiler will
  warn if you try to pass a NULL wait channel.  The functions already have
  a KASSERT to that effect.
2007-03-09 22:41:01 +00:00
John Baldwin
e6b69890ed - Document cv_wait_unlock(9).
- Don't claim that the mutex is atomically reacquired when a cv_wait
  routine returns.  There's nothing atomic or magical about the lock
  reacquire.  The only magic is that we atomically drop the lock by
  placing the thread on the sleep queue before dropping the lock.
2007-03-09 16:59:27 +00:00
John Baldwin
cc61ffc3fb - Sort functions in the order that rwlock(9) and mutex(9) use.
- Markup sx_unlock() as a function rather than saying it is a macro.
  The macro part is an implementation detail, and all the other sx_*lock()
  functions are actually macros, too.
- Use the same style as rwlock(9) and mutex(9) to markup sx_assert() and
  SX_SYSINIT() with respect to headers and kernel options.
- Add a missing MLINK.
2007-03-09 16:52:26 +00:00
John Baldwin
7d3052bbc4 - Sort rwlock functions similar to the order in mutex(9).
- Add a missing MLINK.
2007-03-09 16:44:58 +00:00
Chad David
6c2478125a Add vfs_getopt.9 to the build, and add links for related functions. 2007-03-02 17:03:56 +00:00
Robert Watson
149b6b0b12 Add rw_wowned(9) symlink. 2007-02-26 19:09:36 +00:00
Ruslan Ermilov
066eef7a1d Remove the traces of vm_page_unmanage(). 2007-02-25 06:51:11 +00:00
John Baldwin
37e80fcac2 Add a new kernel sleep function pause(9). pause(9) is for places that
want an equivalent of DELAY(9) that sleeps instead of spins.  It accepts
a wmesg and a timeout and is not interrupted by signals.  It uses a private
wait channel that should never be woken up by wakeup(9) or wakeup_one(9).

Glanced at by:	phk
2007-02-23 16:22:09 +00:00
Pawel Jakub Dawidek
eb62f84553 VFS_VPTOFH(9) was replaced with VOP_VPTOFH(9).
VFS_VPTOFH.9 was repo-copied to VOP_VPTOFH.9.

Repo-copy done by:	joe
2007-02-16 14:27:59 +00:00
John Baldwin
f4ad756aef MLINK for bus_dmamap_load_mbuf_sg(9) 2007-02-12 17:53:21 +00:00
Robert Watson
806c2dc9bf Add MLINKS for sf_buf.9. 2007-01-29 11:27:44 +00:00
Robert Watson
5a05988c32 Add a rudimentary man page for sf_bufs, based on my rudimentary
understanding of sf_bufs.
2007-01-28 16:07:50 +00:00
Randall Stewart
b939bb368a Reviewed by: rwatson
Approved by:	gnn

Add a new function hashinit_flags() which allows NOT-waiting
for memory (or waiting). The old hashinit() function now
calls hashinit_flags(..., HASH_WAITOK);
2007-01-15 15:06:28 +00:00
Robert Watson
6a751174bd Add a basic man page for the socket(9) kernel programming interface used
by the NFS client and server, netsmb, netncp, etc.

Reviewed by:	ru
Fixed by:	ru
2006-12-15 23:35:15 +00:00
Warner Losh
f0bab87823 devsw() was removed by phk:
revision 1.199
	date: 2004/09/24 08:30:57;  author: phk;  state: Exp;  lines: +0 -1
	Remove the cdevsw() function which is now unused.

(the log is wrong, it was really devsw that was removed).

# we really need to actually document the functions in sys/conf.h as well
# as things like d_open...
2006-11-25 22:36:09 +00:00
Ceri Davies
9bda7d940b Add manuals for cr_cansee(9) and p_cansee(9).
Thanks to Ruslan for the time he spent reviewing these.

Reviewed by:	ru
Approved by:	ru
2006-11-19 13:35:03 +00:00
Ruslan Ermilov
cd852a2996 Fix build (forgotten MUTEX_PROFILING.9 -> LOCK_PROFILING.9). 2006-11-11 08:59:34 +00:00
Robert Watson
800c940832 Add a new priv(9) kernel interface for checking the availability of
privilege for threads and credentials.  Unlike the existing suser(9)
interface, priv(9) exposes a named privilege identifier to the privilege
checking code, allowing more complex policies regarding the granting of
privilege to be expressed.  Two interfaces are provided, replacing the
existing suser(9) interface:

suser(td)                 ->   priv_check(td, priv)
suser_cred(cred, flags)   ->   priv_check_cred(cred, priv, flags)

A comprehensive list of currently available kernel privileges may be
found in priv.h.  New privileges are easily added as required, but the
comments on adding privileges found in priv.h and priv(9) should be read
before doing so.

The new privilege interface exposed sufficient information to the
privilege checking routine that it will now be possible for jail to
determine whether a particular privilege is granted in the check routine,
rather than relying on hints from the calling context via the
SUSER_ALLOWJAIL flag.  For now, the flag is maintained, but a new jail
check function, prison_priv_check(), is exposed from kern_jail.c and used
by the privilege check routine to determine if the privilege is permitted
in jail.  As a result, a centralized list of privileges permitted in jail
is now present in kern_jail.c.

The MAC Framework is now also able to instrument privilege checks, both
to deny privileges otherwise granted (mac_priv_check()), and to grant
privileges otherwise denied (mac_priv_grant()), permitting MAC Policy
modules to implement privilege models, as well as control a much broader
range of system behavior in order to constrain processes running with
root privilege.

The suser() and suser_cred() functions remain implemented, now in terms
of priv_check() and the PRIV_ROOT privilege, for use during the transition
and possibly continuing use by third party kernel modules that have not
been updated.  The PRIV_DRIVER privilege exists to allow device drivers to
check privilege without adopting a more specific privilege identifier.

This change does not modify the actual security policy, rather, it
modifies the interface for privilege checks so changes to the security
policy become more feasible.

Sponsored by:		nCircle Network Security, Inc.
Obtained from:		TrustedBSD Project
Discussed on:		arch@
Reviewed (at least in part) by:	mlaier, jmg, pjd, bde, ceri,
			Alex Lyashkov <umka at sevcity dot net>,
			Skip Ford <skip dot ford at verizon dot net>,
			Antoine Brodin <antoine dot brodin at laposte dot net>
2006-11-06 13:37:19 +00:00
Ruslan Ermilov
72377e4c4b Sort MAN and MLINKS lists. 2006-10-05 12:40:44 +00:00
John-Mark Gurney
32d5d9ffc9 sort MLINKS properly
Pointed out by:	ru
2006-10-05 08:55:35 +00:00
John-Mark Gurney
90db62aca6 add man page talking about how to interface w/ the kqueue system so others
can write additional filters...

mdoc police please!
2006-10-04 20:16:23 +00:00
Andre Oppermann
b2c1b09193 Connect hash(9) to the build and add MLINKS for all functions.
Pointed out by:	ru
2006-10-02 11:51:25 +00:00
Warner Losh
fa81ece897 Document config_intrhook.
MFC After: 250 millifortnights
2006-09-25 20:12:13 +00:00
Maxim Konovalov
533baf579b o Sort sx(9) MLINKS. 2006-07-12 19:12:16 +00:00
Pawel Jakub Dawidek
d8e7058159 Document sx_xlocked(9).
Submitted by:	ssouhlal
2006-07-12 15:40:35 +00:00
Warner Losh
9f14302d3c Add a stub man page for device_get_sysctl{_ctx,tree}. Needs some
work, but is better than nothing.  Any help appreciated.
2006-05-23 22:11:20 +00:00
Robert Watson
dba9e9ccbf Add a basic man page for the sysctl(9) macro interfaces. Previously man
pages existed only for the dynamic sysctl interfaces.  There's probably
more complete and accurate content, better advice, etc, that could be added
here.

Per scottl's suggest, add a small piece of moralizing text regarding the
fact that sysctl names quickly get embedded in system configuration files,
libraries, third party applications, and even books, so renaming and
removing names after they've been published is a tricky issue.

MFC after:	1 month
2006-04-28 10:45:27 +00:00
John-Mark Gurney
af3b868186 document the various bus_space_*_stream_? functions... 2006-04-22 03:58:41 +00:00
John Baldwin
c1ffaf8c9a Add MLINKS for rwlock(9). 2006-04-19 21:09:39 +00:00
John-Mark Gurney
18f1afb9f4 add links for the functions documented in bus_space.9... 2006-04-04 22:56:08 +00:00
Gleb Smirnoff
3182fc7b3e Document read/write locks.
Reviewed by:	jhb, ru
2006-02-01 19:39:25 +00:00
Pawel Jakub Dawidek
847a2a1716 Add buffer corruption protection (RedZone) for kernel's malloc(9).
It detects both: buffer underflows and buffer overflows bugs at runtime
(on free(9) and realloc(9)) and prints backtraces from where memory was
allocated and from where it was freed.

Tested by:	kris
2006-01-31 11:09:21 +00:00
Max Laier
6aec1278dc firmware(9) is a subsystem to load binary data into the kernel via a
specially crafted module.  There are several handrolled sollutions to this
problem in the tree already which will be replaced with this.  They include
iwi(4), ipw(4), ispfw(4) and digi(4).

No objection from:	arch
MFC after:		2 weeks
X-MFC after:		some drivers have been converted
2006-01-29 02:52:42 +00:00
John Baldwin
61d963bc57 - Don't list sleep() in the NAME section as we haven't had a sleep()
function in years.
- Change the 'ident' paramters to 'wchan' to match <sys/systm.h>.
- Use 'otherwise' in place of 'else' in one place so that this reads like
  English rather than C.
- Document the new msleep_spin() function.
- Add history notes for msleep() and msleep_spin().
2006-01-03 17:00:38 +00:00
Ian Dowse
0a9a8c2efa Add basic documentation for many of the kernel USB functions that
USB device drivers use to talk to USB devices. This is probably
still a bit rough and it does not yet include the functions specific
to HID, ethernet, hubs, host controller drivers, task threads or
debugging.
2005-12-31 03:53:02 +00:00
John Baldwin
eefd941ba2 Update this manpage:
- Remove references to cpu_critical_*() as they no longer exist.
- Explain that any preemptions that occur during a critical section are
  deferred until the current thread exits the section.
- Remove a bogus example usage of a critical section.
- Note that one can interlock critical sections with spin mutexes in
  certain situations.

MFC after:	3 days
2005-10-05 19:48:21 +00:00
Ruslan Ermilov
bf5a89d1d5 Sort MLINKS. 2005-09-28 07:32:43 +00:00
John Baldwin
4ea211a4f4 - Document atomic_fetchadd(9) and add a MLINK.
- Add arm and ppc to the list of archs not supporting operations on 64-bit
  integers.
- Update the sample code for acquiring a mutex to be more recent and to
  take into account the recent atomic_foo_ptr() changes.

MFC after:	1 week
2005-09-27 17:59:29 +00:00
Robert Watson
6b8a3687a1 Add discussion of Giant, the MPSAFE flag, and NDHASGIANT() to namei(9).
Add a VFS_LOCK_GIANT(9)/VFS_UNLOCK_GIANT(9) man page.

Discussed with:	jeff
MFC after:	3 days
2005-09-21 10:19:57 +00:00
Scott Long
e91f1998a1 Now that VFS_START.9 has been removed, don't try to reference it from the
Makefile.
2005-07-27 02:08:21 +00:00
Warner Losh
751c35718a Don a flack jacket and start to document the FreeBSD bus_space
implementation.  I took the NetBSD man page, and hacked it to, I hope,
to reflect the preliminary version of the bus space that Justin Gibbs
committed as part of the CAM integration in FreeBSD 3.0.

This isn't perfect, but it is better than we have now (which is, ahem,
nothing).  Please coordinate changes to the file through me through
the 6.0 release.

Approved by: re (blanket for this one file)
2005-06-14 03:40:01 +00:00
Hiten Pandya
27c3fa33d9 Add manual page for newly added pmap_page_init(9) function, part of the
PMAP KPI.

Reviewed-by:	alc
2005-06-10 17:16:16 +00:00
Gleb Smirnoff
f9e6931c3d Manpage for unit allocator functions.
Reviewed by:	phk
2005-04-20 19:11:05 +00:00