xref: /f-stack/freebsd/sys/_lockmgr.h (revision 22ce4aff)
1a9643ea8Slogwang /*-
2*22ce4affSfengbojiang  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3*22ce4affSfengbojiang  *
4a9643ea8Slogwang  * Copyright (c) 2008 Attilio Rao <[email protected]>
5a9643ea8Slogwang  * All rights reserved.
6a9643ea8Slogwang  *
7a9643ea8Slogwang  * Redistribution and use in source and binary forms, with or without
8a9643ea8Slogwang  * modification, are permitted provided that the following conditions
9a9643ea8Slogwang  * are met:
10a9643ea8Slogwang  * 1. Redistributions of source code must retain the above copyright
11a9643ea8Slogwang  *    notice(s), this list of conditions and the following disclaimer as
12a9643ea8Slogwang  *    the first lines of this file unmodified other than the possible
13a9643ea8Slogwang  *    addition of one or more copyright notices.
14a9643ea8Slogwang  * 2. Redistributions in binary form must reproduce the above copyright
15a9643ea8Slogwang  *    notice(s), this list of conditions and the following disclaimer in the
16a9643ea8Slogwang  *    documentation and/or other materials provided with the distribution.
17a9643ea8Slogwang  *
18a9643ea8Slogwang  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
19a9643ea8Slogwang  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20a9643ea8Slogwang  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21a9643ea8Slogwang  * DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
22a9643ea8Slogwang  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23a9643ea8Slogwang  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24a9643ea8Slogwang  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25a9643ea8Slogwang  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26a9643ea8Slogwang  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27a9643ea8Slogwang  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
28a9643ea8Slogwang  * DAMAGE.
29a9643ea8Slogwang  *
30a9643ea8Slogwang  * $FreeBSD$
31a9643ea8Slogwang  */
32a9643ea8Slogwang 
33a9643ea8Slogwang #ifndef _SYS__LOCKMGR_H_
34a9643ea8Slogwang #define	_SYS__LOCKMGR_H_
35a9643ea8Slogwang 
36a9643ea8Slogwang #ifdef DEBUG_LOCKS
37a9643ea8Slogwang #include <sys/_stack.h>
38a9643ea8Slogwang #endif
39a9643ea8Slogwang 
40a9643ea8Slogwang struct lock {
41a9643ea8Slogwang 	struct lock_object	lock_object;
42a9643ea8Slogwang 	volatile uintptr_t	lk_lock;
43a9643ea8Slogwang 	u_int			lk_exslpfail;
44a9643ea8Slogwang 	int			lk_timo;
45a9643ea8Slogwang 	int			lk_pri;
46a9643ea8Slogwang #ifdef DEBUG_LOCKS
47a9643ea8Slogwang 	struct stack		lk_stack;
48a9643ea8Slogwang #endif
49a9643ea8Slogwang };
50a9643ea8Slogwang 
51a9643ea8Slogwang #endif
52