xref: /illumos-gate/usr/src/uts/common/sys/winlockio.h (revision 2d6eb4a5)
1 /*
2  * CDDL HEADER START
3  *
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.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_WINLOCKIO_H
28 #define	_SYS_WINLOCKIO_H
29 
30 #include <sys/types.h>
31 #include <sys/ioccom.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * Structure for allocating lock contexts.
39  * The page number portion of sy_ident is the offset for mmap(2).
40  * The page offset portion of sy_ident is the byte-offset relative to
41  * the start of the page returned by mmap(2) and should added to it.
42  */
43 
44 struct	winlockalloc {
45 	uint_t	sy_key;		/* user-provided key, if any */
46 	uint_t	sy_ident;	/* system-provided identification */
47 };
48 
49 /*
50  * Structure for getting and setting lock timeouts or NOTIMEOUT flag
51  */
52 
53 struct	winlocktimeout {
54 	uint_t	sy_ident;	/* system-provided identification */
55 	uint_t	sy_timeout;	/* timeout value in seconds */
56 	int	sy_flags;	/* Flags for lock context - see defs below */
57 };
58 
59 #define	WIOC	('L'<<8)
60 
61 
62 #define	WINLOCKALLOC		(WIOC|0)
63 #define	WINLOCKFREE		(WIOC|1)
64 #define	WINLOCKSETTIMEOUT	(WIOC|2)
65 #define	WINLOCKGETTIMEOUT	(WIOC|3)
66 #define	WINLOCKDUMP		(WIOC|4)
67 
68 #ifndef GRABPAGEALLOC
69 #include <sys/fbio.h>		/* defines GRAB* ioctls */
70 #endif
71 
72 /* flag bits */
73 #define	SY_NOTIMEOUT	0x1	/* This client never times out */
74 
75 #ifdef	_KERNEL
76 
77 #define	UFLAGS		0x00ff	/* flags usable by users */
78 #define	KFLAGS		0xff00	/* flags used by driver implementation */
79 #define	TRASHPAGE	0x0400	/* process has unlock mapping to trashpage */
80 
81 #endif	/* _KERNEL */
82 
83 #ifdef	__cplusplus
84 }
85 #endif
86 
87 #endif	/* _SYS_WINLOCKIO_H */
88