diff --git a/en_US.ISO8859-1/books/arch-handbook/book.sgml b/en_US.ISO8859-1/books/arch-handbook/book.sgml
index 4e64f19df1..1006c9f5d2 100644
--- a/en_US.ISO8859-1/books/arch-handbook/book.sgml
+++ b/en_US.ISO8859-1/books/arch-handbook/book.sgml
@@ -1,515 +1,520 @@
%bookinfo;
+
+%man;
%chapters;
]>
FreeBSD Developers' Handbook
The FreeBSD Documentation Project
doc@FreeBSD.org
August 2000
2000
The FreeBSD Documentation Project
&bookinfo.legalnotice;
Welcome to the Developers' Handbook.
Introduction
Developing on FreeBSD
This will need to discuss FreeBSD as a development
platform, the vision of BSD, architectural overview, layout of
/usr/src, history, etc.
Thank you for considering FreeBSD as your development
platform! We hope it will not let you down.
The BSD Vision
Architectural Overview
The Layout of /usr/src
The complete source code to FreeBSD is available from our
public CVS repository. The source code is normally installed in
/usr/src which contains the
following subdirectories.
Directory
Description
bin/
Source for files in
/bin
contrib/
Source for files from contribued software.
crypto/
DES source
etc/
Source for files in /etc
games/
Source for files in /usr/games
gnu/
Utilities covered by the GNU Public License
include/
Source for files in /usr/include
kerberosIV/
Source for Kerbereros version IV
kerberos5/
Source for Kerbereros version 5
lib/
Source for files in /usr/lib
libexec/
Source for files in /usr/libexec
release/
Files required to produce a FreeBSD release
sbin/
Source for files in /sbin
secure/
FreeSec sources
share/
Source for files in /sbin
sys/
Kernel source files
tools/
Tools used for maintenance and testing of
FreeBSD
usr.bin/
Source for files in /usr/bin
usr.sbin/
Source for files in /usr/sbin
Basics
&chap.tools;
&chap.secure;
Kernel
History of the Unix Kernel
Some history of the Unix/BSD kernel, system calls, how do
processes work, blocking, scheduling, threads (kernel),
context switching, signals, interrupts, modules, etc.
+
+ &chap.locking;
+
Memory and Virtual Memory
Virtual Memory
VM, paging, swapping, allocating memory, testing for
memory leaks, mmap, vnodes, etc.
I/O System
UFS
UFS, FFS, Ext2FS, JFS, inodes, buffer cache, labeling,
locking, metadata, soft-updates, LFS, portalfs, procfs,
vnodes, memory sharing, memory objects, TLBs, caching
Interprocess Communication
Signals
Signals, pipes, semaphores, message queues, shared memory,
ports, sockets, doors
Networking
Sockets
Sockets, bpf, IP, TCP, UDP, ICMP, OSI, bridging,
firewalling, NAT, switching, etc
Network Filesystems
AFS
AFS, NFS, SANs etc]
Terminal Handling
Syscons
Syscons, tty, PCVT, serial console, screen savers,
etc
Sound
OSS
OSS, waveforms, etc
Device Drivers
&chap.driverbasics;
&chap.pci;
USB Devices
This chapter will talk about the FreeBSD mechanisms for
writing a device driver for a device on a USB bus.
NewBus
This chapter will talk about the FreeBSD NewBus
architecture.
Architectures
IA-32
Talk about the architectural specifics of FreeBSD/x86.
Alpha
Talk about the architectural specifics of
FreeBSD/alpha.
Explanation of allignment errors, how to fix, how to
ignore.
Example assembly language code for FreeBSD/alpha.
IA-64
Talk about the architectural specifics of
FreeBSD/ia64.
Debugging
Truss
various descriptions on how to debug certain aspects of
the system using truss, ktrace, gdb, kgdb, etc
Compatibility Layers
Linux
Linux, SVR4, etc
Appendices
Dave
A
Patterson
John
L
Hennessy
1998Morgan Kaufmann Publishers,
Inc.
1-55860-428-6
Morgan Kaufmann Publishers, Inc.
Computer Organization and Design
The Hardware / Software Interface
1-2
W.
Richard
Stevens
1993Addison Wesley Longman,
Inc.
0-201-56317-7
Addison Wesley Longman, Inc.
Advanced Programming in the Unix Environment
1-2
Marshall
Kirk
McKusick
Keith
Bostic
Michael
J
Karels
John
S
Quarterman
1996Addison-Wesley Publishing Company,
Inc.
0-201-54979-4
Addison-Wesley Publishing Company, Inc.
The Design and Implementation of the 4.4 BSD Operating System
1-2
Aleph
One
Phrack 49; "Smashing the Stack for Fun and Profit"
Chrispin
Cowan
Calton
Pu
Dave
Maier
StackGuard; Automatic Adaptive Detection and Prevention of
Buffer-Overflow Attacks
Todd
Miller
Theo
de Raadt
strlcpy and strlcat -- consistent, safe string copy and
concatenation.
diff --git a/en_US.ISO8859-1/books/arch-handbook/chapters.ent b/en_US.ISO8859-1/books/arch-handbook/chapters.ent
index e73ab6af45..c2149880e2 100644
--- a/en_US.ISO8859-1/books/arch-handbook/chapters.ent
+++ b/en_US.ISO8859-1/books/arch-handbook/chapters.ent
@@ -1,57 +1,58 @@
+
diff --git a/en_US.ISO8859-1/books/arch-handbook/locking/chapter.sgml b/en_US.ISO8859-1/books/arch-handbook/locking/chapter.sgml
new file mode 100644
index 0000000000..54448a06ef
--- /dev/null
+++ b/en_US.ISO8859-1/books/arch-handbook/locking/chapter.sgml
@@ -0,0 +1,312 @@
+
+
+
+ Locking Notes
+
+ This chapter is maintained by the FreeBSD SMP Next
+ Generation Project
+ freebsd-smp@FreeBSD.org.
+
+
+ This document outlines the locking used in the FreeBSD kernel
+ to permit effective multi-processing within the kernel. Locking
+ can be achieved via several means. Data structures can be
+ protected by mutexes or &man.lockmgr.9; locks. A few variables
+ are protected simply by always using atomic operations to access
+ them.
+
+
+ Mutexes
+
+ A mutex is simply a lock used to guarantee mutual exclusion.
+ Specifically, a mutex may only be owned by one entity at a time.
+ If another entity wishes to obtain a mutex that is already
+ owned, it must wait until the mutex is released. In the FreeBSD
+ kernel, mutexes are owned by processes.
+
+ Mutexes may be recursively acquired, but they are intended
+ to be held for a short period of time. Specifically, one may
+ not sleep while holding a mutex. If you need to hold a lock
+ across a sleep, use a &man.lockmgr.9; lock.
+
+ Each mutex has several properties of interest:
+
+
+
+ Variable Name
+
+ The name of the struct mtx variable in
+ the kernel source.
+
+
+
+
+ Logical Name
+
+ The name of the mutex assigned to it by
+ mtx_init. This name is displayed in
+ KTR trace messages and witness errors and warnings and is
+ used to distinguish mutexes in the witness code.
+
+
+
+
+ Type
+
+ The type of the mutex in terms of the
+ MTX_* flags. The meaning for each
+ flag is related to its meaning as documented in
+ &man.mutex.9;.
+
+
+
+ MTX_DEF
+
+ A sleep mutex
+
+
+
+
+ MTX_SPIN
+
+ A spin mutex
+
+
+
+
+ MTX_COLD
+
+ This mutex is initialized very early. Thus, it
+ must be declared via
+ MUTEX_DECLARE, and the
+ MTX_COLD flag must be passed to
+ mtx_init.
+
+
+
+
+ MTX_TOPHALF
+
+ This spin mutex does not disable
+ interrupts.
+
+
+
+
+ MTX_NORECURSE
+
+ This mutex is not allowed to recurse.
+
+
+
+
+
+
+
+ Protectees
+
+ A list of data structures or data structure members
+ that this entry protects. For data structure members, the
+ name will be in the form of
+
+
+
+
+
+ Dependent Functions
+
+ Functions that can only be called if this mutex is
+ held.
+
+
+
+
+
+ Mutex List
+
+
+
+
+ Variable Name
+ Logical Name
+ Type
+ Protectees
+ Dependent Functions
+
+
+
+
+
+
+ sched_lock
+ sched lock
+
+ MTX_SPIN |
+ MTX_COLD
+
+
+ _gmonparam,
+ cnt.v_swtch,
+ cp_time,
+ curpriority,
+ P_PROFIL XXX,
+ P_INMEM,
+ P_SINTR,
+ P_TIMEOUT,
+ P_SWAPINREQ XXX,
+ P_INMEN XXX),
+ p_prof/,
+ p_ru/,
+ statclock),
+ pscnt,
+ slpque,
+ itqueuebits,
+ itqueues,
+ rtqueuebits,
+ rtqueues,
+ queuebits,
+ queues,
+ idqueuebits,
+ idqueues,
+ callwheel,
+ nextsoftcheck,
+ switchtime,
+ softticks,
+ ticks
+
+
+ setrunqueue,
+ remrunqueue,
+ mi_switch,
+ chooseproc,
+ schedclock,
+ resetpriority,
+ updatepri,
+ maybe_resched,
+ cpu_switch,
+ cpu_throw
+
+
+
+
+
+ vm86pcb_lock
+ vm86pcb lock
+
+ MTX_DEF |
+ MTX_COLD
+
+
+ vm86pcb
+
+
+ vm86_bioscall
+
+
+
+
+
+ Giant
+ Giant
+
+ MTX_DEF |
+ MTX_COLD
+
+ nearly everything
+ lots
+
+
+
+
+
+
+
+ Lock Manager Locks
+
+ Locks that are provided via the &man.lockmgr.9; interface
+ are lock manager locks. These locks are reader-writer locks and
+ may be held by a sleeping process.
+
+
+ &man.lockmgr.9; Lock List
+
+
+
+
+ Variable Name
+ Protectees
+
+
+
+
+ allproc_lock
+
+ allproc
+ zombproc
+ pidhashtbl
+ nextpid
+
+
+
+
+
+
+
+
+ Atomically Protected Variables
+
+ An atomically protected variable is a special variable that
+ is not protected by an explicit lock. Instead, all data
+ accesses to the variables use special atomic operations as
+ described in &man.atomic.9;. Very few variables are treated
+ this way, although other synchronization primitives such as
+ mutexes are implemented with atomically protected
+ variables.
+
+
+
+ astpending
+
+
+
+
+
+
+
+
diff --git a/en_US.ISO8859-1/books/developers-handbook/book.sgml b/en_US.ISO8859-1/books/developers-handbook/book.sgml
index 4e64f19df1..1006c9f5d2 100644
--- a/en_US.ISO8859-1/books/developers-handbook/book.sgml
+++ b/en_US.ISO8859-1/books/developers-handbook/book.sgml
@@ -1,515 +1,520 @@
%bookinfo;
+
+%man;
%chapters;
]>
FreeBSD Developers' Handbook
The FreeBSD Documentation Project
doc@FreeBSD.org
August 2000
2000
The FreeBSD Documentation Project
&bookinfo.legalnotice;
Welcome to the Developers' Handbook.
Introduction
Developing on FreeBSD
This will need to discuss FreeBSD as a development
platform, the vision of BSD, architectural overview, layout of
/usr/src, history, etc.
Thank you for considering FreeBSD as your development
platform! We hope it will not let you down.
The BSD Vision
Architectural Overview
The Layout of /usr/src
The complete source code to FreeBSD is available from our
public CVS repository. The source code is normally installed in
/usr/src which contains the
following subdirectories.
Directory
Description
bin/
Source for files in
/bin
contrib/
Source for files from contribued software.
crypto/
DES source
etc/
Source for files in /etc
games/
Source for files in /usr/games
gnu/
Utilities covered by the GNU Public License
include/
Source for files in /usr/include
kerberosIV/
Source for Kerbereros version IV
kerberos5/
Source for Kerbereros version 5
lib/
Source for files in /usr/lib
libexec/
Source for files in /usr/libexec
release/
Files required to produce a FreeBSD release
sbin/
Source for files in /sbin
secure/
FreeSec sources
share/
Source for files in /sbin
sys/
Kernel source files
tools/
Tools used for maintenance and testing of
FreeBSD
usr.bin/
Source for files in /usr/bin
usr.sbin/
Source for files in /usr/sbin
Basics
&chap.tools;
&chap.secure;
Kernel
History of the Unix Kernel
Some history of the Unix/BSD kernel, system calls, how do
processes work, blocking, scheduling, threads (kernel),
context switching, signals, interrupts, modules, etc.
+
+ &chap.locking;
+
Memory and Virtual Memory
Virtual Memory
VM, paging, swapping, allocating memory, testing for
memory leaks, mmap, vnodes, etc.
I/O System
UFS
UFS, FFS, Ext2FS, JFS, inodes, buffer cache, labeling,
locking, metadata, soft-updates, LFS, portalfs, procfs,
vnodes, memory sharing, memory objects, TLBs, caching
Interprocess Communication
Signals
Signals, pipes, semaphores, message queues, shared memory,
ports, sockets, doors
Networking
Sockets
Sockets, bpf, IP, TCP, UDP, ICMP, OSI, bridging,
firewalling, NAT, switching, etc
Network Filesystems
AFS
AFS, NFS, SANs etc]
Terminal Handling
Syscons
Syscons, tty, PCVT, serial console, screen savers,
etc
Sound
OSS
OSS, waveforms, etc
Device Drivers
&chap.driverbasics;
&chap.pci;
USB Devices
This chapter will talk about the FreeBSD mechanisms for
writing a device driver for a device on a USB bus.
NewBus
This chapter will talk about the FreeBSD NewBus
architecture.
Architectures
IA-32
Talk about the architectural specifics of FreeBSD/x86.
Alpha
Talk about the architectural specifics of
FreeBSD/alpha.
Explanation of allignment errors, how to fix, how to
ignore.
Example assembly language code for FreeBSD/alpha.
IA-64
Talk about the architectural specifics of
FreeBSD/ia64.
Debugging
Truss
various descriptions on how to debug certain aspects of
the system using truss, ktrace, gdb, kgdb, etc
Compatibility Layers
Linux
Linux, SVR4, etc
Appendices
Dave
A
Patterson
John
L
Hennessy
1998Morgan Kaufmann Publishers,
Inc.
1-55860-428-6
Morgan Kaufmann Publishers, Inc.
Computer Organization and Design
The Hardware / Software Interface
1-2
W.
Richard
Stevens
1993Addison Wesley Longman,
Inc.
0-201-56317-7
Addison Wesley Longman, Inc.
Advanced Programming in the Unix Environment
1-2
Marshall
Kirk
McKusick
Keith
Bostic
Michael
J
Karels
John
S
Quarterman
1996Addison-Wesley Publishing Company,
Inc.
0-201-54979-4
Addison-Wesley Publishing Company, Inc.
The Design and Implementation of the 4.4 BSD Operating System
1-2
Aleph
One
Phrack 49; "Smashing the Stack for Fun and Profit"
Chrispin
Cowan
Calton
Pu
Dave
Maier
StackGuard; Automatic Adaptive Detection and Prevention of
Buffer-Overflow Attacks
Todd
Miller
Theo
de Raadt
strlcpy and strlcat -- consistent, safe string copy and
concatenation.
diff --git a/en_US.ISO8859-1/books/developers-handbook/chapters.ent b/en_US.ISO8859-1/books/developers-handbook/chapters.ent
index e73ab6af45..c2149880e2 100644
--- a/en_US.ISO8859-1/books/developers-handbook/chapters.ent
+++ b/en_US.ISO8859-1/books/developers-handbook/chapters.ent
@@ -1,57 +1,58 @@
+
diff --git a/en_US.ISO8859-1/books/developers-handbook/locking/chapter.sgml b/en_US.ISO8859-1/books/developers-handbook/locking/chapter.sgml
new file mode 100644
index 0000000000..54448a06ef
--- /dev/null
+++ b/en_US.ISO8859-1/books/developers-handbook/locking/chapter.sgml
@@ -0,0 +1,312 @@
+
+
+
+ Locking Notes
+
+ This chapter is maintained by the FreeBSD SMP Next
+ Generation Project
+ freebsd-smp@FreeBSD.org.
+
+
+ This document outlines the locking used in the FreeBSD kernel
+ to permit effective multi-processing within the kernel. Locking
+ can be achieved via several means. Data structures can be
+ protected by mutexes or &man.lockmgr.9; locks. A few variables
+ are protected simply by always using atomic operations to access
+ them.
+
+
+ Mutexes
+
+ A mutex is simply a lock used to guarantee mutual exclusion.
+ Specifically, a mutex may only be owned by one entity at a time.
+ If another entity wishes to obtain a mutex that is already
+ owned, it must wait until the mutex is released. In the FreeBSD
+ kernel, mutexes are owned by processes.
+
+ Mutexes may be recursively acquired, but they are intended
+ to be held for a short period of time. Specifically, one may
+ not sleep while holding a mutex. If you need to hold a lock
+ across a sleep, use a &man.lockmgr.9; lock.
+
+ Each mutex has several properties of interest:
+
+
+
+ Variable Name
+
+ The name of the struct mtx variable in
+ the kernel source.
+
+
+
+
+ Logical Name
+
+ The name of the mutex assigned to it by
+ mtx_init. This name is displayed in
+ KTR trace messages and witness errors and warnings and is
+ used to distinguish mutexes in the witness code.
+
+
+
+
+ Type
+
+ The type of the mutex in terms of the
+ MTX_* flags. The meaning for each
+ flag is related to its meaning as documented in
+ &man.mutex.9;.
+
+
+
+ MTX_DEF
+
+ A sleep mutex
+
+
+
+
+ MTX_SPIN
+
+ A spin mutex
+
+
+
+
+ MTX_COLD
+
+ This mutex is initialized very early. Thus, it
+ must be declared via
+ MUTEX_DECLARE, and the
+ MTX_COLD flag must be passed to
+ mtx_init.
+
+
+
+
+ MTX_TOPHALF
+
+ This spin mutex does not disable
+ interrupts.
+
+
+
+
+ MTX_NORECURSE
+
+ This mutex is not allowed to recurse.
+
+
+
+
+
+
+
+ Protectees
+
+ A list of data structures or data structure members
+ that this entry protects. For data structure members, the
+ name will be in the form of
+
+
+
+
+
+ Dependent Functions
+
+ Functions that can only be called if this mutex is
+ held.
+
+
+
+
+
+ Mutex List
+
+
+
+
+ Variable Name
+ Logical Name
+ Type
+ Protectees
+ Dependent Functions
+
+
+
+
+
+
+ sched_lock
+ sched lock
+
+ MTX_SPIN |
+ MTX_COLD
+
+
+ _gmonparam,
+ cnt.v_swtch,
+ cp_time,
+ curpriority,
+ P_PROFIL XXX,
+ P_INMEM,
+ P_SINTR,
+ P_TIMEOUT,
+ P_SWAPINREQ XXX,
+ P_INMEN XXX),
+ p_prof/,
+ p_ru/,
+ statclock),
+ pscnt,
+ slpque,
+ itqueuebits,
+ itqueues,
+ rtqueuebits,
+ rtqueues,
+ queuebits,
+ queues,
+ idqueuebits,
+ idqueues,
+ callwheel,
+ nextsoftcheck,
+ switchtime,
+ softticks,
+ ticks
+
+
+ setrunqueue,
+ remrunqueue,
+ mi_switch,
+ chooseproc,
+ schedclock,
+ resetpriority,
+ updatepri,
+ maybe_resched,
+ cpu_switch,
+ cpu_throw
+
+
+
+
+
+ vm86pcb_lock
+ vm86pcb lock
+
+ MTX_DEF |
+ MTX_COLD
+
+
+ vm86pcb
+
+
+ vm86_bioscall
+
+
+
+
+
+ Giant
+ Giant
+
+ MTX_DEF |
+ MTX_COLD
+
+ nearly everything
+ lots
+
+
+
+
+
+
+
+ Lock Manager Locks
+
+ Locks that are provided via the &man.lockmgr.9; interface
+ are lock manager locks. These locks are reader-writer locks and
+ may be held by a sleeping process.
+
+
+ &man.lockmgr.9; Lock List
+
+
+
+
+ Variable Name
+ Protectees
+
+
+
+
+ allproc_lock
+
+ allproc
+ zombproc
+ pidhashtbl
+ nextpid
+
+
+
+
+
+
+
+
+ Atomically Protected Variables
+
+ An atomically protected variable is a special variable that
+ is not protected by an explicit lock. Instead, all data
+ accesses to the variables use special atomic operations as
+ described in &man.atomic.9;. Very few variables are treated
+ this way, although other synchronization primitives such as
+ mutexes are implemented with atomically protected
+ variables.
+
+
+
+ astpending
+
+
+
+
+
+
+
+
diff --git a/en_US.ISO_8859-1/books/developers-handbook/book.sgml b/en_US.ISO_8859-1/books/developers-handbook/book.sgml
index 4e64f19df1..1006c9f5d2 100644
--- a/en_US.ISO_8859-1/books/developers-handbook/book.sgml
+++ b/en_US.ISO_8859-1/books/developers-handbook/book.sgml
@@ -1,515 +1,520 @@
%bookinfo;
+
+%man;
%chapters;
]>
FreeBSD Developers' Handbook
The FreeBSD Documentation Project
doc@FreeBSD.org
August 2000
2000
The FreeBSD Documentation Project
&bookinfo.legalnotice;
Welcome to the Developers' Handbook.
Introduction
Developing on FreeBSD
This will need to discuss FreeBSD as a development
platform, the vision of BSD, architectural overview, layout of
/usr/src, history, etc.
Thank you for considering FreeBSD as your development
platform! We hope it will not let you down.
The BSD Vision
Architectural Overview
The Layout of /usr/src
The complete source code to FreeBSD is available from our
public CVS repository. The source code is normally installed in
/usr/src which contains the
following subdirectories.
Directory
Description
bin/
Source for files in
/bin
contrib/
Source for files from contribued software.
crypto/
DES source
etc/
Source for files in /etc
games/
Source for files in /usr/games
gnu/
Utilities covered by the GNU Public License
include/
Source for files in /usr/include
kerberosIV/
Source for Kerbereros version IV
kerberos5/
Source for Kerbereros version 5
lib/
Source for files in /usr/lib
libexec/
Source for files in /usr/libexec
release/
Files required to produce a FreeBSD release
sbin/
Source for files in /sbin
secure/
FreeSec sources
share/
Source for files in /sbin
sys/
Kernel source files
tools/
Tools used for maintenance and testing of
FreeBSD
usr.bin/
Source for files in /usr/bin
usr.sbin/
Source for files in /usr/sbin
Basics
&chap.tools;
&chap.secure;
Kernel
History of the Unix Kernel
Some history of the Unix/BSD kernel, system calls, how do
processes work, blocking, scheduling, threads (kernel),
context switching, signals, interrupts, modules, etc.
+
+ &chap.locking;
+
Memory and Virtual Memory
Virtual Memory
VM, paging, swapping, allocating memory, testing for
memory leaks, mmap, vnodes, etc.
I/O System
UFS
UFS, FFS, Ext2FS, JFS, inodes, buffer cache, labeling,
locking, metadata, soft-updates, LFS, portalfs, procfs,
vnodes, memory sharing, memory objects, TLBs, caching
Interprocess Communication
Signals
Signals, pipes, semaphores, message queues, shared memory,
ports, sockets, doors
Networking
Sockets
Sockets, bpf, IP, TCP, UDP, ICMP, OSI, bridging,
firewalling, NAT, switching, etc
Network Filesystems
AFS
AFS, NFS, SANs etc]
Terminal Handling
Syscons
Syscons, tty, PCVT, serial console, screen savers,
etc
Sound
OSS
OSS, waveforms, etc
Device Drivers
&chap.driverbasics;
&chap.pci;
USB Devices
This chapter will talk about the FreeBSD mechanisms for
writing a device driver for a device on a USB bus.
NewBus
This chapter will talk about the FreeBSD NewBus
architecture.
Architectures
IA-32
Talk about the architectural specifics of FreeBSD/x86.
Alpha
Talk about the architectural specifics of
FreeBSD/alpha.
Explanation of allignment errors, how to fix, how to
ignore.
Example assembly language code for FreeBSD/alpha.
IA-64
Talk about the architectural specifics of
FreeBSD/ia64.
Debugging
Truss
various descriptions on how to debug certain aspects of
the system using truss, ktrace, gdb, kgdb, etc
Compatibility Layers
Linux
Linux, SVR4, etc
Appendices
Dave
A
Patterson
John
L
Hennessy
1998Morgan Kaufmann Publishers,
Inc.
1-55860-428-6
Morgan Kaufmann Publishers, Inc.
Computer Organization and Design
The Hardware / Software Interface
1-2
W.
Richard
Stevens
1993Addison Wesley Longman,
Inc.
0-201-56317-7
Addison Wesley Longman, Inc.
Advanced Programming in the Unix Environment
1-2
Marshall
Kirk
McKusick
Keith
Bostic
Michael
J
Karels
John
S
Quarterman
1996Addison-Wesley Publishing Company,
Inc.
0-201-54979-4
Addison-Wesley Publishing Company, Inc.
The Design and Implementation of the 4.4 BSD Operating System
1-2
Aleph
One
Phrack 49; "Smashing the Stack for Fun and Profit"
Chrispin
Cowan
Calton
Pu
Dave
Maier
StackGuard; Automatic Adaptive Detection and Prevention of
Buffer-Overflow Attacks
Todd
Miller
Theo
de Raadt
strlcpy and strlcat -- consistent, safe string copy and
concatenation.
diff --git a/en_US.ISO_8859-1/books/developers-handbook/chapters.ent b/en_US.ISO_8859-1/books/developers-handbook/chapters.ent
index e73ab6af45..c2149880e2 100644
--- a/en_US.ISO_8859-1/books/developers-handbook/chapters.ent
+++ b/en_US.ISO_8859-1/books/developers-handbook/chapters.ent
@@ -1,57 +1,58 @@
+
diff --git a/en_US.ISO_8859-1/books/developers-handbook/locking/chapter.sgml b/en_US.ISO_8859-1/books/developers-handbook/locking/chapter.sgml
new file mode 100644
index 0000000000..54448a06ef
--- /dev/null
+++ b/en_US.ISO_8859-1/books/developers-handbook/locking/chapter.sgml
@@ -0,0 +1,312 @@
+
+
+
+ Locking Notes
+
+ This chapter is maintained by the FreeBSD SMP Next
+ Generation Project
+ freebsd-smp@FreeBSD.org.
+
+
+ This document outlines the locking used in the FreeBSD kernel
+ to permit effective multi-processing within the kernel. Locking
+ can be achieved via several means. Data structures can be
+ protected by mutexes or &man.lockmgr.9; locks. A few variables
+ are protected simply by always using atomic operations to access
+ them.
+
+
+ Mutexes
+
+ A mutex is simply a lock used to guarantee mutual exclusion.
+ Specifically, a mutex may only be owned by one entity at a time.
+ If another entity wishes to obtain a mutex that is already
+ owned, it must wait until the mutex is released. In the FreeBSD
+ kernel, mutexes are owned by processes.
+
+ Mutexes may be recursively acquired, but they are intended
+ to be held for a short period of time. Specifically, one may
+ not sleep while holding a mutex. If you need to hold a lock
+ across a sleep, use a &man.lockmgr.9; lock.
+
+ Each mutex has several properties of interest:
+
+
+
+ Variable Name
+
+ The name of the struct mtx variable in
+ the kernel source.
+
+
+
+
+ Logical Name
+
+ The name of the mutex assigned to it by
+ mtx_init. This name is displayed in
+ KTR trace messages and witness errors and warnings and is
+ used to distinguish mutexes in the witness code.
+
+
+
+
+ Type
+
+ The type of the mutex in terms of the
+ MTX_* flags. The meaning for each
+ flag is related to its meaning as documented in
+ &man.mutex.9;.
+
+
+
+ MTX_DEF
+
+ A sleep mutex
+
+
+
+
+ MTX_SPIN
+
+ A spin mutex
+
+
+
+
+ MTX_COLD
+
+ This mutex is initialized very early. Thus, it
+ must be declared via
+ MUTEX_DECLARE, and the
+ MTX_COLD flag must be passed to
+ mtx_init.
+
+
+
+
+ MTX_TOPHALF
+
+ This spin mutex does not disable
+ interrupts.
+
+
+
+
+ MTX_NORECURSE
+
+ This mutex is not allowed to recurse.
+
+
+
+
+
+
+
+ Protectees
+
+ A list of data structures or data structure members
+ that this entry protects. For data structure members, the
+ name will be in the form of
+
+
+
+
+
+ Dependent Functions
+
+ Functions that can only be called if this mutex is
+ held.
+
+
+
+
+
+ Mutex List
+
+
+
+
+ Variable Name
+ Logical Name
+ Type
+ Protectees
+ Dependent Functions
+
+
+
+
+
+
+ sched_lock
+ sched lock
+
+ MTX_SPIN |
+ MTX_COLD
+
+
+ _gmonparam,
+ cnt.v_swtch,
+ cp_time,
+ curpriority,
+ P_PROFIL XXX,
+ P_INMEM,
+ P_SINTR,
+ P_TIMEOUT,
+ P_SWAPINREQ XXX,
+ P_INMEN XXX),
+ p_prof/,
+ p_ru/,
+ statclock),
+ pscnt,
+ slpque,
+ itqueuebits,
+ itqueues,
+ rtqueuebits,
+ rtqueues,
+ queuebits,
+ queues,
+ idqueuebits,
+ idqueues,
+ callwheel,
+ nextsoftcheck,
+ switchtime,
+ softticks,
+ ticks
+
+
+ setrunqueue,
+ remrunqueue,
+ mi_switch,
+ chooseproc,
+ schedclock,
+ resetpriority,
+ updatepri,
+ maybe_resched,
+ cpu_switch,
+ cpu_throw
+
+
+
+
+
+ vm86pcb_lock
+ vm86pcb lock
+
+ MTX_DEF |
+ MTX_COLD
+
+
+ vm86pcb
+
+
+ vm86_bioscall
+
+
+
+
+
+ Giant
+ Giant
+
+ MTX_DEF |
+ MTX_COLD
+
+ nearly everything
+ lots
+
+
+
+
+
+
+
+ Lock Manager Locks
+
+ Locks that are provided via the &man.lockmgr.9; interface
+ are lock manager locks. These locks are reader-writer locks and
+ may be held by a sleeping process.
+
+
+ &man.lockmgr.9; Lock List
+
+
+
+
+ Variable Name
+ Protectees
+
+
+
+
+ allproc_lock
+
+ allproc
+ zombproc
+ pidhashtbl
+ nextpid
+
+
+
+
+
+
+
+
+ Atomically Protected Variables
+
+ An atomically protected variable is a special variable that
+ is not protected by an explicit lock. Instead, all data
+ accesses to the variables use special atomic operations as
+ described in &man.atomic.9;. Very few variables are treated
+ this way, although other synchronization primitives such as
+ mutexes are implemented with atomically protected
+ variables.
+
+
+
+ astpending
+
+
+
+
+
+
+
+