xref: /onnv-gate/usr/src/lib/libbc/inc/include/sys/ioccom.h (revision 722:636b850d4ee9)
10Sstevel@tonic-gate /*
2*722Smuffin  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
30Sstevel@tonic-gate  * Use is subject to license terms.
40Sstevel@tonic-gate  */
50Sstevel@tonic-gate 
60Sstevel@tonic-gate /*
70Sstevel@tonic-gate  * Copyright (c) 1982, 1986 Regents of the University of California.
80Sstevel@tonic-gate  * All rights reserved.  The Berkeley software License Agreement
90Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
100Sstevel@tonic-gate  */
110Sstevel@tonic-gate 
120Sstevel@tonic-gate #ifndef	__sys_ioccom_h
130Sstevel@tonic-gate #define	__sys_ioccom_h
140Sstevel@tonic-gate 
15*722Smuffin #pragma ident	"%Z%%M%	%I%	%E% SMI"
16*722Smuffin 
170Sstevel@tonic-gate /*
180Sstevel@tonic-gate  * Ioctl's have the command encoded in the lower word,
190Sstevel@tonic-gate  * and the size of any in or out parameters in the upper
200Sstevel@tonic-gate  * word.  The high 2 bits of the upper word are used
210Sstevel@tonic-gate  * to encode the in/out status of the parameter; for now
220Sstevel@tonic-gate  * we restrict parameters to at most 255 bytes.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate #define	_IOCPARM_MASK	0xff		/* parameters must be < 256 bytes */
250Sstevel@tonic-gate #define	_IOC_VOID	0x20000000	/* no parameters */
260Sstevel@tonic-gate #define	_IOC_OUT	0x40000000	/* copy out parameters */
270Sstevel@tonic-gate #define	_IOC_IN		0x80000000	/* copy in parameters */
280Sstevel@tonic-gate #define	_IOC_INOUT	(_IOC_IN|_IOC_OUT)
29*722Smuffin 
300Sstevel@tonic-gate /* the 0x20000000 is so we can distinguish new ioctl's from old */
31*722Smuffin #define	_IO(x,y)	(_IOC_VOID|(x<<8)|y)
32*722Smuffin #define	_IOR(x,y,t)	(_IOC_OUT|((sizeof(t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
33*722Smuffin #define	_IORN(x,y,t)	(_IOC_OUT|(((t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
34*722Smuffin #define	_IOW(x,y,t)	(_IOC_IN|((sizeof(t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
35*722Smuffin #define	_IOWN(x,y,t)	(_IOC_IN|(((t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
360Sstevel@tonic-gate /* this should be _IORW, but stdio got there first */
37*722Smuffin #define	_IOWR(x,y,t)	(_IOC_INOUT|((sizeof(t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
38*722Smuffin #define	_IOWRN(x,y,t)	(_IOC_INOUT|(((t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
390Sstevel@tonic-gate 
400Sstevel@tonic-gate /*
410Sstevel@tonic-gate  * Registry of ioctl characters, culled from system sources
420Sstevel@tonic-gate  *
430Sstevel@tonic-gate  * char	file where defined		notes
440Sstevel@tonic-gate  * ----	------------------		-----
450Sstevel@tonic-gate  *   F	sun/fbio.h
460Sstevel@tonic-gate  *   G	sun/gpio.h
470Sstevel@tonic-gate  *   H	vaxif/if_hy.h
480Sstevel@tonic-gate  *   M	sundev/mcpcmd.h			*overlap*
490Sstevel@tonic-gate  *   M	sys/modem.h			*overlap*
500Sstevel@tonic-gate  *   S	sys/stropts.h
510Sstevel@tonic-gate  *   T	sys/termio.h			-no overlap-
520Sstevel@tonic-gate  *   T	sys/termios.h			-no overlap-
530Sstevel@tonic-gate  *   V	sundev/mdreg.h
540Sstevel@tonic-gate  *   a	vaxuba/adreg.h
550Sstevel@tonic-gate  *   d	sun/dkio.h			-no overlap with sys/des.h-
560Sstevel@tonic-gate  *   d	sys/des.h			(possible overlap)
570Sstevel@tonic-gate  *   d	vax/dkio.h			(possible overlap)
580Sstevel@tonic-gate  *   d	vaxuba/rxreg.h			(possible overlap)
590Sstevel@tonic-gate  *   f	sys/filio.h
600Sstevel@tonic-gate  *   g	sunwindow/win_ioctl.h		-no overlap-
610Sstevel@tonic-gate  *   g	sunwindowdev/winioctl.c		!no manifest constant! -no overlap-
620Sstevel@tonic-gate  *   h	sundev/hrc_common.h
630Sstevel@tonic-gate  *   i	sys/sockio.h			*overlap*
640Sstevel@tonic-gate  *   i	vaxuba/ikreg.h			*overlap*
650Sstevel@tonic-gate  *   k	sundev/kbio.h
660Sstevel@tonic-gate  *   m	sundev/msio.h			(possible overlap)
670Sstevel@tonic-gate  *   m	sundev/msreg.h			(possible overlap)
680Sstevel@tonic-gate  *   m	sys/mtio.h			(possible overlap)
690Sstevel@tonic-gate  *   n	sun/ndio.h
700Sstevel@tonic-gate  *   p	net/nit_buf.h			(possible overlap)
710Sstevel@tonic-gate  *   p	net/nit_if.h			(possible overlap)
720Sstevel@tonic-gate  *   p	net/nit_pf.h			(possible overlap)
730Sstevel@tonic-gate  *   p	sundev/fpareg.h			(possible overlap)
740Sstevel@tonic-gate  *   p	sys/sockio.h			(possible overlap)
750Sstevel@tonic-gate  *   p	vaxuba/psreg.h			(possible overlap)
760Sstevel@tonic-gate  *   q	sun/sqz.h
770Sstevel@tonic-gate  *   r	sys/sockio.h
780Sstevel@tonic-gate  *   s	sys/sockio.h
790Sstevel@tonic-gate  *   t	sys/ttold.h			(possible overlap)
800Sstevel@tonic-gate  *   t	sys/ttycom.h			(possible overlap)
810Sstevel@tonic-gate  *   v	sundev/vuid_event.h		*overlap*
820Sstevel@tonic-gate  *   v	sys/vcmd.h			*overlap*
830Sstevel@tonic-gate  *
840Sstevel@tonic-gate  * End of Registry
850Sstevel@tonic-gate  */
860Sstevel@tonic-gate 
870Sstevel@tonic-gate #endif /* !__sys_ioccom_h */
88