xref: /onnv-gate/usr/src/uts/common/sys/utssys.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23*0Sstevel@tonic-gate /*	  All Rights Reserved  	*/
24*0Sstevel@tonic-gate 
25*0Sstevel@tonic-gate 
26*0Sstevel@tonic-gate /*
27*0Sstevel@tonic-gate  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
28*0Sstevel@tonic-gate  * Use is subject to license terms.
29*0Sstevel@tonic-gate  */
30*0Sstevel@tonic-gate 
31*0Sstevel@tonic-gate #ifndef _SYS_UTSSYS_H
32*0Sstevel@tonic-gate #define	_SYS_UTSSYS_H
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.1 */
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #ifdef	__cplusplus
37*0Sstevel@tonic-gate extern "C" {
38*0Sstevel@tonic-gate #endif
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate /*
41*0Sstevel@tonic-gate  * Definitions related to the utssys() system call.
42*0Sstevel@tonic-gate  */
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate /*
45*0Sstevel@tonic-gate  * "commands" of utssys
46*0Sstevel@tonic-gate  */
47*0Sstevel@tonic-gate #define	UTS_UNAME	0x0	/* obsolete */
48*0Sstevel@tonic-gate #define	UTS_USTAT	0x2	/* 1 was umask */
49*0Sstevel@tonic-gate #define	UTS_FUSERS	0x3
50*0Sstevel@tonic-gate 
51*0Sstevel@tonic-gate /*
52*0Sstevel@tonic-gate  * Flags to UTS_FUSERS
53*0Sstevel@tonic-gate  */
54*0Sstevel@tonic-gate #define	F_FILE_ONLY	0x01
55*0Sstevel@tonic-gate #define	F_CONTAINED	0x02
56*0Sstevel@tonic-gate #define	F_NBMANDLIST	0x04	/* Only NBMAND locks users */
57*0Sstevel@tonic-gate #define	F_DEVINFO	0x08	/* get device usage info for a dip instead */
58*0Sstevel@tonic-gate 				/* of a minor node */
59*0Sstevel@tonic-gate #define	F_KINFO_COUNT	0x10	/* get the current number of kernel */
60*0Sstevel@tonic-gate 				/* device consumers */
61*0Sstevel@tonic-gate 
62*0Sstevel@tonic-gate /*
63*0Sstevel@tonic-gate  * structures yielded by UTS_FUSERS
64*0Sstevel@tonic-gate  */
65*0Sstevel@tonic-gate typedef struct f_user {
66*0Sstevel@tonic-gate 	int	fu_flags;	/* see below */
67*0Sstevel@tonic-gate 	union {
68*0Sstevel@tonic-gate 		struct {
69*0Sstevel@tonic-gate 			pid_t	u_pid;
70*0Sstevel@tonic-gate 			uid_t	u_uid;
71*0Sstevel@tonic-gate 		} u_info;
72*0Sstevel@tonic-gate 		struct {
73*0Sstevel@tonic-gate 			int	k_modid;
74*0Sstevel@tonic-gate 			int	k_instance;
75*0Sstevel@tonic-gate 			int	k_minor;
76*0Sstevel@tonic-gate 		} k_info;
77*0Sstevel@tonic-gate 	} fu_info;
78*0Sstevel@tonic-gate } f_user_t;
79*0Sstevel@tonic-gate 
80*0Sstevel@tonic-gate typedef struct fu_data {
81*0Sstevel@tonic-gate 	int		fud_user_max;
82*0Sstevel@tonic-gate 	int		fud_user_count;
83*0Sstevel@tonic-gate 	struct f_user	fud_user[1];
84*0Sstevel@tonic-gate } fu_data_t;
85*0Sstevel@tonic-gate 
86*0Sstevel@tonic-gate /*
87*0Sstevel@tonic-gate  * defines to simplify access to members of the f_user_t structure
88*0Sstevel@tonic-gate  */
89*0Sstevel@tonic-gate #define	fu_pid		fu_info.u_info.u_pid
90*0Sstevel@tonic-gate #define	fu_uid		fu_info.u_info.u_uid
91*0Sstevel@tonic-gate 
92*0Sstevel@tonic-gate #define	fu_modid	fu_info.k_info.k_modid
93*0Sstevel@tonic-gate #define	fu_instance	fu_info.k_info.k_instance
94*0Sstevel@tonic-gate #define	fu_minor	fu_info.k_info.k_minor
95*0Sstevel@tonic-gate 
96*0Sstevel@tonic-gate #define	fu_data_size(x)	(sizeof (fu_data_t) - sizeof (f_user_t) + \
97*0Sstevel@tonic-gate 				((x) * sizeof (f_user_t)))
98*0Sstevel@tonic-gate 
99*0Sstevel@tonic-gate /*
100*0Sstevel@tonic-gate  * fu_flags values
101*0Sstevel@tonic-gate  */
102*0Sstevel@tonic-gate #define	F_CDIR		0x1
103*0Sstevel@tonic-gate #define	F_RDIR		0x2
104*0Sstevel@tonic-gate #define	F_TEXT		0x4
105*0Sstevel@tonic-gate #define	F_MAP		0x8
106*0Sstevel@tonic-gate #define	F_OPEN		0x10
107*0Sstevel@tonic-gate #define	F_TRACE		0x20
108*0Sstevel@tonic-gate #define	F_TTY		0x40
109*0Sstevel@tonic-gate #define	F_NBM		0x80	/* NBMAND lock in place */
110*0Sstevel@tonic-gate #define	F_KERNEL	0x80000000
111*0Sstevel@tonic-gate 
112*0Sstevel@tonic-gate #ifdef	__cplusplus
113*0Sstevel@tonic-gate }
114*0Sstevel@tonic-gate #endif
115*0Sstevel@tonic-gate 
116*0Sstevel@tonic-gate #endif /* _SYS_UTSSYS_H */
117