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