xref: /freebsd/share/man/man9/vm_map_lock.9 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1.\"
2.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd July 19, 2003
27.Dt VM_MAP_LOCK 9
28.Os
29.Sh NAME
30.Nm vm_map_lock ,
31.Nm vm_map_unlock ,
32.Nm vm_map_lock_read ,
33.Nm vm_map_unlock_read ,
34.Nm vm_map_trylock ,
35.Nm vm_map_trylock_read ,
36.Nm vm_map_lock_upgrade ,
37.Nm vm_map_lock_downgrade
38.Nd vm_map locking macros
39.Sh SYNOPSIS
40.In sys/param.h
41.In vm/vm.h
42.In vm/vm_map.h
43.Ft void
44.Fn vm_map_lock "vm_map_t map"
45.Ft void
46.Fn vm_map_unlock "vm_map_t map"
47.Ft void
48.Fn vm_map_lock_read "vm_map_t map"
49.Ft void
50.Fn vm_map_unlock_read "vm_map_t map"
51.Ft int
52.Fn vm_map_trylock "vm_map_t map"
53.Ft int
54.Fn vm_map_trylock_read "vm_map_t map"
55.Ft int
56.Fn vm_map_lock_upgrade "vm_map_t map"
57.Ft int
58.Fn vm_map_lock_downgrade "vm_map_t map"
59.Sh DESCRIPTION
60The
61.Fn vm_map_lock
62macro obtains an exclusive lock on
63.Fa map .
64.Pp
65The
66.Fn vm_map_unlock
67macro releases an exclusive lock on
68.Fa map .
69.Pp
70The
71.Fn vm_map_lock_read
72macro obtains a read-lock on
73.Fa map .
74.Pp
75The
76.Fn vm_map_unlock_read
77macro releases a read-lock on
78.Fa map .
79.Pp
80The
81.Fn vm_map_trylock
82macro attempts to obtain an exclusive lock on
83.Fa map .
84It returns FALSE if the lock cannot be immediately acquired;
85otherwise return TRUE with the lock acquired.
86.Pp
87The
88.Fn vm_map_trylock_read
89macro attempts to obtain a read-lock on
90.Fa map .
91It returns FALSE if the lock cannot be immediately acquired;
92otherwise return TRUE with the lock acquired.
93.Pp
94The
95.Fn vm_map_lock_upgrade
96macro attempts to atomically upgrade a read-lock on
97.Fa map
98to an exclusive lock.
99.Pp
100The
101.Fn vm_map_lock_downgrade
102macro attempts to downgrade an exclusive lock on
103.Fa map
104to a read-lock.
105.Sh IMPLEMENTATION NOTES
106Currently, all of the locking macros implement their locks as sleep locks.
107.Sh SEE ALSO
108.Xr vm_map 9
109.Sh AUTHORS
110This manual page was written by
111.An Bruce M Simpson Aq Mt bms@spc.org .
112