Merge commit '7e3488dc6cdcb0c04e1ce167a1a3bfef83b5f2e0'
[unleashed.git] / include / sys / t_lock.h
blob34b0ad9d3470b63e2ec5ba6b54836aa57bde9be7
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 #ifndef _ASM
37 #include <sys/machlock.h>
38 #include <sys/param.h>
39 #include <sys/mutex.h>
40 #include <sys/rwlock.h>
41 #include <sys/semaphore.h>
42 #include <sys/condvar.h>
43 #endif /* _ASM */
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
49 #ifndef _ASM
52 * Mutual exclusion locks described in common/sys/mutex.h.
54 * Semaphores described in common/sys/semaphore.h.
56 * Readers/Writer locks described in common/sys/rwlock.h.
58 * Condition variables described in common/sys/condvar.h
61 #if defined(_KERNEL)
63 extern int ncpus;
66 * Dispatcher lock type, macros and routines.
68 * disp_lock_t is defined in machlock.h
70 extern void disp_lock_enter(disp_lock_t *);
71 extern void disp_lock_exit(disp_lock_t *);
72 extern void disp_lock_exit_nopreempt(disp_lock_t *);
73 extern void disp_lock_enter_high(disp_lock_t *);
74 extern void disp_lock_exit_high(disp_lock_t *);
75 extern void disp_lock_init(disp_lock_t *lp, char *name);
76 extern void disp_lock_destroy(disp_lock_t *lp);
78 #define DISP_LOCK_INIT(lp) LOCK_INIT_CLEAR((lock_t *)(lp))
79 #define DISP_LOCK_HELD(lp) LOCK_HELD((lock_t *)(lp))
80 #define DISP_LOCK_DESTROY(lp) ASSERT(!DISP_LOCK_HELD(lp))
83 * The following definitions are for assertions which can be checked
84 * statically by tools like lock_lint. You can also define your own
85 * run-time test for each. If you don't, we define them to 1 so that
86 * such assertions simply pass.
88 #ifndef NO_LOCKS_HELD
89 #define NO_LOCKS_HELD 1
90 #endif
91 #ifndef NO_COMPETING_THREADS
92 #define NO_COMPETING_THREADS 1
93 #endif
95 #endif /* defined(_KERNEL) */
97 #endif /* _ASM */
99 #ifdef __cplusplus
101 #endif
103 #endif /* _SYS_T_LOCK_H */