xref: /illumos-gate/usr/src/uts/common/sys/utssys.h (revision b4203d75)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23*b4203d75SMarcel Telka /*	  All Rights Reserved	*/
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*
277c478bd9Sstevel@tonic-gate  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
287c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
297c478bd9Sstevel@tonic-gate  */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifndef _SYS_UTSSYS_H
327c478bd9Sstevel@tonic-gate #define	_SYS_UTSSYS_H
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
357c478bd9Sstevel@tonic-gate extern "C" {
367c478bd9Sstevel@tonic-gate #endif
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate /*
397c478bd9Sstevel@tonic-gate  * Definitions related to the utssys() system call.
407c478bd9Sstevel@tonic-gate  */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * "commands" of utssys
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate #define	UTS_UNAME	0x0	/* obsolete */
467c478bd9Sstevel@tonic-gate #define	UTS_USTAT	0x2	/* 1 was umask */
477c478bd9Sstevel@tonic-gate #define	UTS_FUSERS	0x3
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate /*
507c478bd9Sstevel@tonic-gate  * Flags to UTS_FUSERS
517c478bd9Sstevel@tonic-gate  */
527c478bd9Sstevel@tonic-gate #define	F_FILE_ONLY	0x01
537c478bd9Sstevel@tonic-gate #define	F_CONTAINED	0x02
547c478bd9Sstevel@tonic-gate #define	F_NBMANDLIST	0x04	/* Only NBMAND locks users */
557c478bd9Sstevel@tonic-gate #define	F_DEVINFO	0x08	/* get device usage info for a dip instead */
567c478bd9Sstevel@tonic-gate 				/* of a minor node */
577c478bd9Sstevel@tonic-gate #define	F_KINFO_COUNT	0x10	/* get the current number of kernel */
587c478bd9Sstevel@tonic-gate 				/* device consumers */
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate /*
617c478bd9Sstevel@tonic-gate  * structures yielded by UTS_FUSERS
627c478bd9Sstevel@tonic-gate  */
637c478bd9Sstevel@tonic-gate typedef struct f_user {
647c478bd9Sstevel@tonic-gate 	int	fu_flags;	/* see below */
657c478bd9Sstevel@tonic-gate 	union {
667c478bd9Sstevel@tonic-gate 		struct {
677c478bd9Sstevel@tonic-gate 			pid_t	u_pid;
687c478bd9Sstevel@tonic-gate 			uid_t	u_uid;
697c478bd9Sstevel@tonic-gate 		} u_info;
707c478bd9Sstevel@tonic-gate 		struct {
717c478bd9Sstevel@tonic-gate 			int	k_modid;
727c478bd9Sstevel@tonic-gate 			int	k_instance;
737c478bd9Sstevel@tonic-gate 			int	k_minor;
747c478bd9Sstevel@tonic-gate 		} k_info;
757c478bd9Sstevel@tonic-gate 	} fu_info;
767c478bd9Sstevel@tonic-gate } f_user_t;
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate typedef struct fu_data {
797c478bd9Sstevel@tonic-gate 	int		fud_user_max;
807c478bd9Sstevel@tonic-gate 	int		fud_user_count;
817c478bd9Sstevel@tonic-gate 	struct f_user	fud_user[1];
827c478bd9Sstevel@tonic-gate } fu_data_t;
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate /*
857c478bd9Sstevel@tonic-gate  * defines to simplify access to members of the f_user_t structure
867c478bd9Sstevel@tonic-gate  */
877c478bd9Sstevel@tonic-gate #define	fu_pid		fu_info.u_info.u_pid
887c478bd9Sstevel@tonic-gate #define	fu_uid		fu_info.u_info.u_uid
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate #define	fu_modid	fu_info.k_info.k_modid
917c478bd9Sstevel@tonic-gate #define	fu_instance	fu_info.k_info.k_instance
927c478bd9Sstevel@tonic-gate #define	fu_minor	fu_info.k_info.k_minor
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate #define	fu_data_size(x)	(sizeof (fu_data_t) - sizeof (f_user_t) + \
957c478bd9Sstevel@tonic-gate 				((x) * sizeof (f_user_t)))
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate /*
987c478bd9Sstevel@tonic-gate  * fu_flags values
997c478bd9Sstevel@tonic-gate  */
1007c478bd9Sstevel@tonic-gate #define	F_CDIR		0x1
1017c478bd9Sstevel@tonic-gate #define	F_RDIR		0x2
1027c478bd9Sstevel@tonic-gate #define	F_TEXT		0x4
1037c478bd9Sstevel@tonic-gate #define	F_MAP		0x8
1047c478bd9Sstevel@tonic-gate #define	F_OPEN		0x10
1057c478bd9Sstevel@tonic-gate #define	F_TRACE		0x20
1067c478bd9Sstevel@tonic-gate #define	F_TTY		0x40
1077c478bd9Sstevel@tonic-gate #define	F_NBM		0x80	/* NBMAND lock in place */
1087c478bd9Sstevel@tonic-gate #define	F_KERNEL	0x80000000
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1117c478bd9Sstevel@tonic-gate }
1127c478bd9Sstevel@tonic-gate #endif
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate #endif /* _SYS_UTSSYS_H */
115