xref: /titanic_44/usr/src/lib/libbc/inc/include/sys/ioccom.h (revision 2b4a78020b9c38d1b95e2f3fefa6d6e4be382d1f)
1 /*
2  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright (c) 1982, 1986 Regents of the University of California.
8  * All rights reserved.  The Berkeley software License Agreement
9  * specifies the terms and conditions for redistribution.
10  */
11 
12 #ifndef	__sys_ioccom_h
13 #define	__sys_ioccom_h
14 
15 #pragma ident	"%Z%%M%	%I%	%E% SMI"
16 
17 /*
18  * Ioctl's have the command encoded in the lower word,
19  * and the size of any in or out parameters in the upper
20  * word.  The high 2 bits of the upper word are used
21  * to encode the in/out status of the parameter; for now
22  * we restrict parameters to at most 255 bytes.
23  */
24 #define	_IOCPARM_MASK	0xff		/* parameters must be < 256 bytes */
25 #define	_IOC_VOID	0x20000000	/* no parameters */
26 #define	_IOC_OUT	0x40000000	/* copy out parameters */
27 #define	_IOC_IN		0x80000000	/* copy in parameters */
28 #define	_IOC_INOUT	(_IOC_IN|_IOC_OUT)
29 
30 /* the 0x20000000 is so we can distinguish new ioctl's from old */
31 #define	_IO(x,y)	(_IOC_VOID|(x<<8)|y)
32 #define	_IOR(x,y,t)	(_IOC_OUT|((sizeof(t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
33 #define	_IORN(x,y,t)	(_IOC_OUT|(((t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
34 #define	_IOW(x,y,t)	(_IOC_IN|((sizeof(t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
35 #define	_IOWN(x,y,t)	(_IOC_IN|(((t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
36 /* this should be _IORW, but stdio got there first */
37 #define	_IOWR(x,y,t)	(_IOC_INOUT|((sizeof(t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
38 #define	_IOWRN(x,y,t)	(_IOC_INOUT|(((t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
39 
40 /*
41  * Registry of ioctl characters, culled from system sources
42  *
43  * char	file where defined		notes
44  * ----	------------------		-----
45  *   F	sun/fbio.h
46  *   G	sun/gpio.h
47  *   H	vaxif/if_hy.h
48  *   M	sundev/mcpcmd.h			*overlap*
49  *   M	sys/modem.h			*overlap*
50  *   S	sys/stropts.h
51  *   T	sys/termio.h			-no overlap-
52  *   T	sys/termios.h			-no overlap-
53  *   V	sundev/mdreg.h
54  *   a	vaxuba/adreg.h
55  *   d	sun/dkio.h			-no overlap with sys/des.h-
56  *   d	sys/des.h			(possible overlap)
57  *   d	vax/dkio.h			(possible overlap)
58  *   d	vaxuba/rxreg.h			(possible overlap)
59  *   f	sys/filio.h
60  *   g	sunwindow/win_ioctl.h		-no overlap-
61  *   g	sunwindowdev/winioctl.c		!no manifest constant! -no overlap-
62  *   h	sundev/hrc_common.h
63  *   i	sys/sockio.h			*overlap*
64  *   i	vaxuba/ikreg.h			*overlap*
65  *   k	sundev/kbio.h
66  *   m	sundev/msio.h			(possible overlap)
67  *   m	sundev/msreg.h			(possible overlap)
68  *   m	sys/mtio.h			(possible overlap)
69  *   n	sun/ndio.h
70  *   p	net/nit_buf.h			(possible overlap)
71  *   p	net/nit_if.h			(possible overlap)
72  *   p	net/nit_pf.h			(possible overlap)
73  *   p	sundev/fpareg.h			(possible overlap)
74  *   p	sys/sockio.h			(possible overlap)
75  *   p	vaxuba/psreg.h			(possible overlap)
76  *   q	sun/sqz.h
77  *   r	sys/sockio.h
78  *   s	sys/sockio.h
79  *   t	sys/ttold.h			(possible overlap)
80  *   t	sys/ttycom.h			(possible overlap)
81  *   v	sundev/vuid_event.h		*overlap*
82  *   v	sys/vcmd.h			*overlap*
83  *
84  * End of Registry
85  */
86 
87 #endif /* !__sys_ioccom_h */
88