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