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