2 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
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.
12 #ifndef __sys_ioccom_h
13 #define __sys_ioccom_h
15 #pragma ident "%Z%%M% %I% %E% SMI"
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.
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)
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)
41 * Registry of ioctl characters, culled from system sources
43 * char file where defined notes
44 * ---- ------------------ -----
48 * M sundev/mcpcmd.h *overlap*
49 * M sys/modem.h *overlap*
51 * T sys/termio.h -no overlap-
52 * T sys/termios.h -no overlap-
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)
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*
66 * m sundev/msio.h (possible overlap)
67 * m sundev/msreg.h (possible overlap)
68 * m sys/mtio.h (possible overlap)
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)
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*
87 #endif /* !__sys_ioccom_h */