xref: /titanic_41/usr/src/uts/common/sys/utssys.h (revision b509e89b2befbaa42939abad9da1d7f5a8c6aaae)
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 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 /*
27  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 #ifndef _SYS_UTSSYS_H
32 #define	_SYS_UTSSYS_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.1 */
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 /*
41  * Definitions related to the utssys() system call.
42  */
43 
44 /*
45  * "commands" of utssys
46  */
47 #define	UTS_UNAME	0x0	/* obsolete */
48 #define	UTS_USTAT	0x2	/* 1 was umask */
49 #define	UTS_FUSERS	0x3
50 
51 /*
52  * Flags to UTS_FUSERS
53  */
54 #define	F_FILE_ONLY	0x01
55 #define	F_CONTAINED	0x02
56 #define	F_NBMANDLIST	0x04	/* Only NBMAND locks users */
57 #define	F_DEVINFO	0x08	/* get device usage info for a dip instead */
58 				/* of a minor node */
59 #define	F_KINFO_COUNT	0x10	/* get the current number of kernel */
60 				/* device consumers */
61 
62 /*
63  * structures yielded by UTS_FUSERS
64  */
65 typedef struct f_user {
66 	int	fu_flags;	/* see below */
67 	union {
68 		struct {
69 			pid_t	u_pid;
70 			uid_t	u_uid;
71 		} u_info;
72 		struct {
73 			int	k_modid;
74 			int	k_instance;
75 			int	k_minor;
76 		} k_info;
77 	} fu_info;
78 } f_user_t;
79 
80 typedef struct fu_data {
81 	int		fud_user_max;
82 	int		fud_user_count;
83 	struct f_user	fud_user[1];
84 } fu_data_t;
85 
86 /*
87  * defines to simplify access to members of the f_user_t structure
88  */
89 #define	fu_pid		fu_info.u_info.u_pid
90 #define	fu_uid		fu_info.u_info.u_uid
91 
92 #define	fu_modid	fu_info.k_info.k_modid
93 #define	fu_instance	fu_info.k_info.k_instance
94 #define	fu_minor	fu_info.k_info.k_minor
95 
96 #define	fu_data_size(x)	(sizeof (fu_data_t) - sizeof (f_user_t) + \
97 				((x) * sizeof (f_user_t)))
98 
99 /*
100  * fu_flags values
101  */
102 #define	F_CDIR		0x1
103 #define	F_RDIR		0x2
104 #define	F_TEXT		0x4
105 #define	F_MAP		0x8
106 #define	F_OPEN		0x10
107 #define	F_TRACE		0x20
108 #define	F_TTY		0x40
109 #define	F_NBM		0x80	/* NBMAND lock in place */
110 #define	F_KERNEL	0x80000000
111 
112 #ifdef	__cplusplus
113 }
114 #endif
115 
116 #endif /* _SYS_UTSSYS_H */
117