6198 Let's EOL cachefs
[illumos-gate.git] / usr / src / uts / common / sys / t_lock.h
blob01ac64b290d1594b005eb6904d20c8a961f110f7
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright (c) 1991-1998 by Sun Microsystems, Inc.
24 * All rights reserved.
28 * t_lock.h: Prototypes for disp_locks, plus include files
29 * that describe the interfaces to kernel synch.
30 * objects.
33 #ifndef _SYS_T_LOCK_H
34 #define _SYS_T_LOCK_H
36 #pragma ident "%Z%%M% %I% %E% SMI"
38 #ifndef _ASM
39 #include <sys/machlock.h>
40 #include <sys/param.h>
41 #include <sys/mutex.h>
42 #include <sys/rwlock.h>
43 #include <sys/semaphore.h>
44 #include <sys/condvar.h>
45 #endif /* _ASM */
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
51 #ifndef _ASM
54 * Mutual exclusion locks described in common/sys/mutex.h.
56 * Semaphores described in common/sys/semaphore.h.
58 * Readers/Writer locks described in common/sys/rwlock.h.
60 * Condition variables described in common/sys/condvar.h
63 #if defined(_KERNEL)
65 extern int ncpus;
68 * Dispatcher lock type, macros and routines.
70 * disp_lock_t is defined in machlock.h
72 extern void disp_lock_enter(disp_lock_t *);
73 extern void disp_lock_exit(disp_lock_t *);
74 extern void disp_lock_exit_nopreempt(disp_lock_t *);
75 extern void disp_lock_enter_high(disp_lock_t *);
76 extern void disp_lock_exit_high(disp_lock_t *);
77 extern void disp_lock_init(disp_lock_t *lp, char *name);
78 extern void disp_lock_destroy(disp_lock_t *lp);
80 #define DISP_LOCK_INIT(lp) LOCK_INIT_CLEAR((lock_t *)(lp))
81 #define DISP_LOCK_HELD(lp) LOCK_HELD((lock_t *)(lp))
82 #define DISP_LOCK_DESTROY(lp) ASSERT(!DISP_LOCK_HELD(lp))
85 * The following definitions are for assertions which can be checked
86 * statically by tools like lock_lint. You can also define your own
87 * run-time test for each. If you don't, we define them to 1 so that
88 * such assertions simply pass.
90 #ifndef NO_LOCKS_HELD
91 #define NO_LOCKS_HELD 1
92 #endif
93 #ifndef NO_COMPETING_THREADS
94 #define NO_COMPETING_THREADS 1
95 #endif
97 #endif /* defined(_KERNEL) */
99 #endif /* _ASM */
101 #ifdef __cplusplus
103 #endif
105 #endif /* _SYS_T_LOCK_H */