PATCH: ioctl reorganization

C. Scott Ananian (cananian@lcs.mit.edu)
Fri, 23 Jan 1998 10:31:22 -0500 (EST)


This is the second version of my ioctl reorganization patch. It moves the
common ioctl header file into linux/ioctl/ioctls.h, where user programs
can find it, and uses the _IO* macros wherever possible, instead of opaque
numeric constants. Again, the purpose of this patch is to centralize the
ioctl lists as much as possible and remove unnecessary code duplication.
Comments are appreciated.
--Scott
@ @
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-oOO-(_)-OOo-=-=-=-=-=
C. Scott Ananian: cananian@lcs.mit.edu / Declare the Truth boldly and
Laboratory for Computer Science/Crypto / without hindrance.
Massachusetts Institute of Technology /META-PARRESIAS AKOLUTOS:Acts 28:31
-.-. .-.. .. ..-. ..-. --- .-. -.. ... -.-. --- - - .- -. .- -. .. .- -.
PGP key available via finger and from http://www.pdos.lcs.mit.edu/~cananian

diff -ruHpN -X badboys linux-2.1.80-clean/include/asm-alpha/ioctls.h linux-2.1.80-ioctl/include/asm-alpha/ioctls.h
--- linux-2.1.80-clean/include/asm-alpha/ioctls.h Thu Dec 4 16:09:01 1997
+++ linux-2.1.80-ioctl/include/asm-alpha/ioctls.h Fri Jan 23 08:52:12 1998
@@ -2,6 +2,7 @@
#define _ASM_ALPHA_IOCTLS_H

#include <asm/ioctl.h>
+#include <linux/ioctl/ioctls.h>

#define FIOCLEX _IO('f', 1)
#define FIONCLEX _IO('f', 2)
@@ -41,15 +42,10 @@
#define TIOCSPGRP _IOW('t', 118, int)
#define TIOCGPGRP _IOR('t', 119, int)

-#define TIOCEXCL 0x540C
-#define TIOCNXCL 0x540D
-#define TIOCSCTTY 0x540E
-
-#define TIOCSTI 0x5412
-#define TIOCMGET 0x5415
-#define TIOCMBIS 0x5416
-#define TIOCMBIC 0x5417
-#define TIOCMSET 0x5418
+#define TIOCEXCL _IOC(0,'T',0x0C,0)
+#define TIOCNXCL _IOC(0,'T',0x0D,0)
+#define TIOCSCTTY _IOC(0,'T',0x0E,0)
+
# define TIOCM_LE 0x001
# define TIOCM_DTR 0x002
# define TIOCM_RTS 0x004
@@ -61,45 +57,5 @@
# define TIOCM_DSR 0x100
# define TIOCM_CD TIOCM_CAR
# define TIOCM_RI TIOCM_RNG
-
-#define TIOCGSOFTCAR 0x5419
-#define TIOCSSOFTCAR 0x541A
-#define TIOCLINUX 0x541C
-#define TIOCCONS 0x541D
-#define TIOCGSERIAL 0x541E
-#define TIOCSSERIAL 0x541F
-#define TIOCPKT 0x5420
-# define TIOCPKT_DATA 0
-# define TIOCPKT_FLUSHREAD 1
-# define TIOCPKT_FLUSHWRITE 2
-# define TIOCPKT_STOP 4
-# define TIOCPKT_START 8
-# define TIOCPKT_NOSTOP 16
-# define TIOCPKT_DOSTOP 32
-
-
-#define TIOCNOTTY 0x5422
-#define TIOCSETD 0x5423
-#define TIOCGETD 0x5424
-#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
-#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
-#define TIOCSBRK 0x5427 /* BSD compatibility */
-#define TIOCCBRK 0x5428 /* BSD compatibility */
-#define TIOCGSID 0x5429 /* Return the session ID of FD */
-
-#define TIOCSERCONFIG 0x5453
-#define TIOCSERGWILD 0x5454
-#define TIOCSERSWILD 0x5455
-#define TIOCGLCKTRMIOS 0x5456
-#define TIOCSLCKTRMIOS 0x5457
-#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
-#define TIOCSERGETLSR 0x5459 /* Get line status register */
- /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
-#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */

#endif /* _ASM_ALPHA_IOCTLS_H */
diff -ruHpN -X badboys linux-2.1.80-clean/include/asm-arm/ioctls.h linux-2.1.80-ioctl/include/asm-arm/ioctls.h
--- linux-2.1.80-clean/include/asm-arm/ioctls.h Tue Jan 20 19:39:42 1998
+++ linux-2.1.80-ioctl/include/asm-arm/ioctls.h Fri Jan 23 08:52:24 1998
@@ -3,76 +3,8 @@

#include <asm/ioctl.h>

-/* 0x54 is just a magic number to make these relatively unique ('T') */
+#include <linux/ioctl/ioctls.h>

-#define TCGETS 0x5401
-#define TCSETS 0x5402
-#define TCSETSW 0x5403
-#define TCSETSF 0x5404
-#define TCGETA 0x5405
-#define TCSETA 0x5406
-#define TCSETAW 0x5407
-#define TCSETAF 0x5408
-#define TCSBRK 0x5409
-#define TCXONC 0x540A
-#define TCFLSH 0x540B
-#define TIOCEXCL 0x540C
-#define TIOCNXCL 0x540D
-#define TIOCSCTTY 0x540E
-#define TIOCGPGRP 0x540F
-#define TIOCSPGRP 0x5410
-#define TIOCOUTQ 0x5411
-#define TIOCSTI 0x5412
-#define TIOCGWINSZ 0x5413
-#define TIOCSWINSZ 0x5414
-#define TIOCMGET 0x5415
-#define TIOCMBIS 0x5416
-#define TIOCMBIC 0x5417
-#define TIOCMSET 0x5418
-#define TIOCGSOFTCAR 0x5419
-#define TIOCSSOFTCAR 0x541A
-#define FIONREAD 0x541B
-#define TIOCINQ FIONREAD
-#define TIOCLINUX 0x541C
-#define TIOCCONS 0x541D
-#define TIOCGSERIAL 0x541E
-#define TIOCSSERIAL 0x541F
-#define TIOCPKT 0x5420
-#define FIONBIO 0x5421
-#define TIOCNOTTY 0x5422
-#define TIOCSETD 0x5423
-#define TIOCGETD 0x5424
-#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
-#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
-#define TIOCSBRK 0x5427 /* BSD compatibility */
-#define TIOCCBRK 0x5428 /* BSD compatibility */
-#define TIOCGSID 0x5429 /* Return the session ID of FD */
-
-#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
-#define FIOCLEX 0x5451
-#define FIOASYNC 0x5452
-#define TIOCSERCONFIG 0x5453
-#define TIOCSERGWILD 0x5454
-#define TIOCSERSWILD 0x5455
-#define TIOCGLCKTRMIOS 0x5456
-#define TIOCSLCKTRMIOS 0x5457
-#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
-#define TIOCSERGETLSR 0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
-#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
-
-/* Used for packet mode */
-#define TIOCPKT_DATA 0
-#define TIOCPKT_FLUSHREAD 1
-#define TIOCPKT_FLUSHWRITE 2
-#define TIOCPKT_STOP 4
-#define TIOCPKT_START 8
-#define TIOCPKT_NOSTOP 16
-#define TIOCPKT_DOSTOP 32
-
-#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
+/* ARM-specific ioctl's go here */

#endif
diff -ruHpN -X badboys linux-2.1.80-clean/include/asm-i386/ioctls.h linux-2.1.80-ioctl/include/asm-i386/ioctls.h
--- linux-2.1.80-clean/include/asm-i386/ioctls.h Thu Dec 4 16:09:01 1997
+++ linux-2.1.80-ioctl/include/asm-i386/ioctls.h Fri Jan 23 08:52:35 1998
@@ -3,76 +3,8 @@

#include <asm/ioctl.h>

-/* 0x54 is just a magic number to make these relatively unique ('T') */
+#include <linux/ioctl/ioctls.h>

-#define TCGETS 0x5401
-#define TCSETS 0x5402
-#define TCSETSW 0x5403
-#define TCSETSF 0x5404
-#define TCGETA 0x5405
-#define TCSETA 0x5406
-#define TCSETAW 0x5407
-#define TCSETAF 0x5408
-#define TCSBRK 0x5409
-#define TCXONC 0x540A
-#define TCFLSH 0x540B
-#define TIOCEXCL 0x540C
-#define TIOCNXCL 0x540D
-#define TIOCSCTTY 0x540E
-#define TIOCGPGRP 0x540F
-#define TIOCSPGRP 0x5410
-#define TIOCOUTQ 0x5411
-#define TIOCSTI 0x5412
-#define TIOCGWINSZ 0x5413
-#define TIOCSWINSZ 0x5414
-#define TIOCMGET 0x5415
-#define TIOCMBIS 0x5416
-#define TIOCMBIC 0x5417
-#define TIOCMSET 0x5418
-#define TIOCGSOFTCAR 0x5419
-#define TIOCSSOFTCAR 0x541A
-#define FIONREAD 0x541B
-#define TIOCINQ FIONREAD
-#define TIOCLINUX 0x541C
-#define TIOCCONS 0x541D
-#define TIOCGSERIAL 0x541E
-#define TIOCSSERIAL 0x541F
-#define TIOCPKT 0x5420
-#define FIONBIO 0x5421
-#define TIOCNOTTY 0x5422
-#define TIOCSETD 0x5423
-#define TIOCGETD 0x5424
-#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
-#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
-#define TIOCSBRK 0x5427 /* BSD compatibility */
-#define TIOCCBRK 0x5428 /* BSD compatibility */
-#define TIOCGSID 0x5429 /* Return the session ID of FD */
-
-#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
-#define FIOCLEX 0x5451
-#define FIOASYNC 0x5452
-#define TIOCSERCONFIG 0x5453
-#define TIOCSERGWILD 0x5454
-#define TIOCSERSWILD 0x5455
-#define TIOCGLCKTRMIOS 0x5456
-#define TIOCSLCKTRMIOS 0x5457
-#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
-#define TIOCSERGETLSR 0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
-#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
-
-/* Used for packet mode */
-#define TIOCPKT_DATA 0
-#define TIOCPKT_FLUSHREAD 1
-#define TIOCPKT_FLUSHWRITE 2
-#define TIOCPKT_STOP 4
-#define TIOCPKT_START 8
-#define TIOCPKT_NOSTOP 16
-#define TIOCPKT_DOSTOP 32
-
-#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
+/* i386-specific ioctl's go here. */

#endif
diff -ruHpN -X badboys linux-2.1.80-clean/include/asm-m68k/ioctls.h linux-2.1.80-ioctl/include/asm-m68k/ioctls.h
--- linux-2.1.80-clean/include/asm-m68k/ioctls.h Thu Dec 4 16:09:01 1997
+++ linux-2.1.80-ioctl/include/asm-m68k/ioctls.h Fri Jan 23 08:52:46 1998
@@ -3,76 +3,8 @@

#include <asm/ioctl.h>

-/* 0x54 is just a magic number to make these relatively unique ('T') */
+#include <linux/ioctl/ioctls.h>

-#define TCGETS 0x5401
-#define TCSETS 0x5402
-#define TCSETSW 0x5403
-#define TCSETSF 0x5404
-#define TCGETA 0x5405
-#define TCSETA 0x5406
-#define TCSETAW 0x5407
-#define TCSETAF 0x5408
-#define TCSBRK 0x5409
-#define TCXONC 0x540A
-#define TCFLSH 0x540B
-#define TIOCEXCL 0x540C
-#define TIOCNXCL 0x540D
-#define TIOCSCTTY 0x540E
-#define TIOCGPGRP 0x540F
-#define TIOCSPGRP 0x5410
-#define TIOCOUTQ 0x5411
-#define TIOCSTI 0x5412
-#define TIOCGWINSZ 0x5413
-#define TIOCSWINSZ 0x5414
-#define TIOCMGET 0x5415
-#define TIOCMBIS 0x5416
-#define TIOCMBIC 0x5417
-#define TIOCMSET 0x5418
-#define TIOCGSOFTCAR 0x5419
-#define TIOCSSOFTCAR 0x541A
-#define FIONREAD 0x541B
-#define TIOCINQ FIONREAD
-#define TIOCLINUX 0x541C
-#define TIOCCONS 0x541D
-#define TIOCGSERIAL 0x541E
-#define TIOCSSERIAL 0x541F
-#define TIOCPKT 0x5420
-#define FIONBIO 0x5421
-#define TIOCNOTTY 0x5422
-#define TIOCSETD 0x5423
-#define TIOCGETD 0x5424
-#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
-#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
-#define TIOCSBRK 0x5427 /* BSD compatibility */
-#define TIOCCBRK 0x5428 /* BSD compatibility */
-#define TIOCGSID 0x5429 /* Return the session ID of FD */
-
-#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
-#define FIOCLEX 0x5451
-#define FIOASYNC 0x5452
-#define TIOCSERCONFIG 0x5453
-#define TIOCSERGWILD 0x5454
-#define TIOCSERSWILD 0x5455
-#define TIOCGLCKTRMIOS 0x5456
-#define TIOCSLCKTRMIOS 0x5457
-#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
-#define TIOCSERGETLSR 0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
-#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
-
-/* Used for packet mode */
-#define TIOCPKT_DATA 0
-#define TIOCPKT_FLUSHREAD 1
-#define TIOCPKT_FLUSHWRITE 2
-#define TIOCPKT_STOP 4
-#define TIOCPKT_START 8
-#define TIOCPKT_NOSTOP 16
-#define TIOCPKT_DOSTOP 32
-
-#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
+/* m68k-specific ioctls go here. */

#endif /* __ARCH_M68K_IOCTLS_H__ */
diff -ruHpN -X badboys linux-2.1.80-clean/include/asm-mips/ioctls.h linux-2.1.80-ioctl/include/asm-mips/ioctls.h
--- linux-2.1.80-clean/include/asm-mips/ioctls.h Thu Jan 22 19:39:23 1998
+++ linux-2.1.80-ioctl/include/asm-mips/ioctls.h Fri Jan 23 09:07:26 1998
@@ -16,29 +16,29 @@
#define tIOC ('t' << 8)
#endif

-#define TCGETA 0x5401
-#define TCSETA 0x5402
-#define TCSETAW 0x5403
-#define TCSETAF 0x5404
-
-#define TCSBRK 0x5405
-#define TCXONC 0x5406
-#define TCFLSH 0x5407
-
-#define TCGETS 0x540d
-#define TCSETS 0x540e
-#define TCSETSW 0x540f
-#define TCSETSF 0x5410
-
-#define TIOCEXCL 0x740d /* set exclusive use of tty */
-#define TIOCNXCL 0x740e /* reset exclusive use of tty */
-#define TIOCOUTQ 0x7472 /* output queue size */
-#define TIOCSTI 0x5472 /* simulate terminal input */
-#define TIOCMGET 0x741d /* get all modem bits */
-#define TIOCMBIS 0x741b /* bis modem bits */
-#define TIOCMBIC 0x741c /* bic modem bits */
-#define TIOCMSET 0x741a /* set all modem bits */
-#define TIOCPKT 0x5470 /* pty: set/clear packet mode */
+#define TCGETA _IOC(0,'T',0x01,0)
+#define TCSETA _IOC(0,'T',0x02,0)
+#define TCSETAW _IOC(0,'T',0x03,0)
+#define TCSETAF _IOC(0,'T',0x04,0)
+
+#define TCSBRK _IOC(0,'T',0x05,0)
+#define TCXONC _IOC(0,'T',0x06,0)
+#define TCFLSH _IOC(0,'T',0x07,0)
+
+#define TCGETS _IOC(0,'T',0x0d,0)
+#define TCSETS _IOC(0,'T',0x0e,0)
+#define TCSETSW _IOC(0,'T',0x0f,0)
+#define TCSETSF _IOC(0,'T',0x10,0)
+
+#define TIOCEXCL _IOC(0,'t',0x0d,0) /* set exclusive use of tty */
+#define TIOCNXCL _IOC(0,'t',0x0e,0) /* reset exclusive use of tty*/
+#define TIOCOUTQ _IOC(0,'t',0x72,0) /* output queue size */
+#define TIOCSTI _IOC(0,'T',0x72,0) /* simulate terminal input */
+#define TIOCMGET _IOC(0,'t',0x1d,0) /* get all modem bits */
+#define TIOCMBIS _IOC(0,'t',0x1b,0) /* bis modem bits */
+#define TIOCMBIC _IOC(0,'t',0x1c,0) /* bic modem bits */
+#define TIOCMSET _IOC(0,'t',0x1a,0) /* set all modem bits */
+#define TIOCPKT _IOC(0,'T',0x70,0) /* pty: set/clear packet mode*/
#define TIOCPKT_DATA 0x00 /* data packet */
#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */
#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
@@ -47,69 +47,69 @@
#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
#if 0
-#define TIOCPKT_IOCTL 0x40 /* state change of pty driver */
+#define TIOCPKT_IOCTL 0x40 /* state change of pty driver*/
#endif
-#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */
-#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */
-#define TIOCNOTTY 0x5471 /* void tty association */
-#define TIOCSETD (tIOC | 1)
-#define TIOCGETD (tIOC | 0)
-
-#define FIOCLEX 0x6601
-#define FIONCLEX 0x6602 /* these numbers need to be adjusted. */
-#define FIOASYNC 0x667d
-#define FIONBIO 0x667e
+#define TIOCSWINSZ _IOW('t',0x67, struct winsize) /* set window size */
+#define TIOCGWINSZ _IOR('t',0x68, struct winsize) /* get window size */
+#define TIOCNOTTY _IOC(0,'T',0x71,0) /* void tty association */
+#define TIOCSETD _IOC(0,'t',0x01,0)
+#define TIOCGETD _IOC(0,'t',0x00,0)
+
+#define FIOCLEX _IOC(0,'f',0x01,0)
+#define FIONCLEX _IOC(0,'f',0x02,0) /* these numbers need to be adjusted. */
+#define FIOASYNC _IOC(0,'f',0x7d,0)
+#define FIONBIO _IOC(0,'f',0x7e,0)

#if defined(__USE_MISC) || defined (__KERNEL__)
-#define TIOCGLTC (tIOC | 116) /* get special local chars */
-#define TIOCSLTC (tIOC | 117) /* set special local chars */
+#define TIOCGLTC _IOC(0,'t',0x74,0) /* get special local chars */
+#define TIOCSLTC _IOC(0,'t',0x75,0) /* set special local chars */
#endif
-#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */
-#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */
-#define TIOCCONS _IOW('t', 120, int) /* become virtual console */
+#define TIOCSPGRP _IOW('t',0x76, int) /* set pgrp of tty */
+#define TIOCGPGRP _IOR('t',0x77, int) /* get pgrp of tty */
+#define TIOCCONS _IOW('t',0x78, int) /* become virtual console */

-#define FIONREAD 0x467f
+#define FIONREAD _IOC(0,'F',0x7f,0)
#define TIOCINQ FIONREAD

#if defined(__USE_MISC) || defined (__KERNEL__)
-#define TIOCGETP (tIOC | 8)
-#define TIOCSETP (tIOC | 9)
-#define TIOCSETN (tIOC | 10) /* TIOCSETP wo flush */
+#define TIOCGETP _IOC(0,'t',0x08,0)
+#define TIOCSETP _IOC(0,'t',0x09,0)
+#define TIOCSETN _IOC(0,'t',0x0A,0) /* TIOCSETP wo flush */
#endif

#if 0
-#define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */
-#define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */
-#define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */
-#define TIOCGETD _IOR('t', 26, int) /* get line discipline */
-#define TIOCSETD _IOW('t', 27, int) /* set line discipline */
+#define TIOCSETA _IOW('t',0x14, struct termios) /* set termios struct */
+#define TIOCSETAW _IOW('t',0x15, struct termios) /* drain output, set */
+#define TIOCSETAF _IOW('t',0x16, struct termios) /* drn out, fls in, set */
+#define TIOCGETD _IOR('t',0x1A, int) /* get line discipline */
+#define TIOCSETD _IOW('t',0x1B, int) /* set line discipline */
/* 127-124 compat */
#endif

/* I hope the range from 0x5480 on is free ... */
-#define TIOCSCTTY 0x5480 /* become controlling tty */
-#define TIOCGSOFTCAR 0x5481
-#define TIOCSSOFTCAR 0x5482
-#define TIOCLINUX 0x5483
-#define TIOCGSERIAL 0x5484
-#define TIOCSSERIAL 0x5485
-
-#define TCSBRKP 0x5486 /* Needed for POSIX tcsendbreak() */
-#define TIOCTTYGSTRUCT 0x5487 /* For debugging only */
-#define TIOCSBRK 0x5427 /* BSD compatibility */
-#define TIOCCBRK 0x5428 /* BSD compatibility */
-#define TIOCGSID 0x5429 /* Return the session ID of FD */
-
-#define TIOCSERCONFIG 0x5488
-#define TIOCSERGWILD 0x5489
-#define TIOCSERSWILD 0x548a
-#define TIOCGLCKTRMIOS 0x548b
-#define TIOCSLCKTRMIOS 0x548c
-#define TIOCSERGSTRUCT 0x548d /* For debugging only */
-#define TIOCSERGETLSR 0x548e /* Get line status register */
-#define TIOCSERGETMULTI 0x548f /* Get multiport config */
-#define TIOCSERSETMULTI 0x5490 /* Set multiport config */
-#define TIOCMIWAIT 0x5491 /* wait for a change on serial input line(s) */
-#define TIOCGICOUNT 0x5492 /* read serial port inline interrupt counts */
+#define TIOCSCTTY _IOC(0,'T',0x80,0) /* become controlling tty */
+#define TIOCGSOFTCAR _IOC(0,'T',0x81,0)
+#define TIOCSSOFTCAR _IOC(0,'T',0x82,0)
+#define TIOCLINUX _IOC(0,'T',0x83,0)
+#define TIOCGSERIAL _IOC(0,'T',0x84,0)
+#define TIOCSSERIAL _IOC(0,'T',0x85,0)
+
+#define TCSBRKP _IOC(0,'T',0x86,0) /* Needed for POSIX tcsendbreak()*/
+#define TIOCTTYGSTRUCT _IOC(0,'T',0x87,0) /* For debugging only */
+#define TIOCSBRK _IOC(0,'T',0x27,0) /* BSD compatibility */
+#define TIOCCBRK _IOC(0,'T',0x28,0) /* BSD compatibility */
+#define TIOCGSID _IOC(0,'T',0x29,0) /* Return the session ID of FD */
+
+#define TIOCSERCONFIG _IOC(0,'T',0x88,0)
+#define TIOCSERGWILD _IOC(0,'T',0x89,0)
+#define TIOCSERSWILD _IOC(0,'T',0x8a,0)
+#define TIOCGLCKTRMIOS _IOC(0,'T',0x8b,0)
+#define TIOCSLCKTRMIOS _IOC(0,'T',0x8c,0)
+#define TIOCSERGSTRUCT _IOC(0,'T',0x8d,0) /* For debugging only */
+#define TIOCSERGETLSR _IOC(0,'T',0x8e,0) /* Get line status register */
+#define TIOCSERGETMULTI _IOC(0,'T',0x8f,0) /* Get multiport config */
+#define TIOCSERSETMULTI _IOC(0,'T',0x90,0) /* Set multiport config */
+#define TIOCMIWAIT _IOC(0,'T',0x91,0) /* wait for a change on serial input line(s) */
+#define TIOCGICOUNT _IOC(0,'T',0x92,0) /* read serial port inline interrupt counts */

#endif /* __ASM_MIPS_IOCTLS_H */
diff -ruHpN -X badboys linux-2.1.80-clean/include/asm-ppc/ioctls.h linux-2.1.80-ioctl/include/asm-ppc/ioctls.h
--- linux-2.1.80-clean/include/asm-ppc/ioctls.h Thu Dec 4 16:09:01 1997
+++ linux-2.1.80-ioctl/include/asm-ppc/ioctls.h Fri Jan 23 09:08:37 1998
@@ -3,6 +3,8 @@

#include <asm/ioctl.h>

+#include <linux/ioctl/ioctls.h>
+
#define FIOCLEX _IO('f', 1)
#define FIONCLEX _IO('f', 2)
#define FIOASYNC _IOW('f', 125, int)
@@ -41,15 +43,10 @@
#define TIOCSPGRP _IOW('t', 118, int)
#define TIOCGPGRP _IOR('t', 119, int)

-#define TIOCEXCL 0x540C
-#define TIOCNXCL 0x540D
-#define TIOCSCTTY 0x540E
-
-#define TIOCSTI 0x5412
-#define TIOCMGET 0x5415
-#define TIOCMBIS 0x5416
-#define TIOCMBIC 0x5417
-#define TIOCMSET 0x5418
+#define TIOCEXCL _IOC(0,'T',0x0C,0)
+#define TIOCNXCL _IOC(0,'T',0x0D,0)
+#define TIOCSCTTY _IOC(0,'T',0x0E,0)
+
# define TIOCM_LE 0x001
# define TIOCM_DTR 0x002
# define TIOCM_RTS 0x004
@@ -61,45 +58,5 @@
# define TIOCM_DSR 0x100
# define TIOCM_CD TIOCM_CAR
# define TIOCM_RI TIOCM_RNG
-
-#define TIOCGSOFTCAR 0x5419
-#define TIOCSSOFTCAR 0x541A
-#define TIOCLINUX 0x541C
-#define TIOCCONS 0x541D
-#define TIOCGSERIAL 0x541E
-#define TIOCSSERIAL 0x541F
-#define TIOCPKT 0x5420
-# define TIOCPKT_DATA 0
-# define TIOCPKT_FLUSHREAD 1
-# define TIOCPKT_FLUSHWRITE 2
-# define TIOCPKT_STOP 4
-# define TIOCPKT_START 8
-# define TIOCPKT_NOSTOP 16
-# define TIOCPKT_DOSTOP 32
-
-
-#define TIOCNOTTY 0x5422
-#define TIOCSETD 0x5423
-#define TIOCGETD 0x5424
-#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
-#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
-#define TIOCSBRK 0x5427 /* BSD compatibility */
-#define TIOCCBRK 0x5428 /* BSD compatibility */
-#define TIOCGSID 0x5429 /* Return the session ID of FD */
-
-#define TIOCSERCONFIG 0x5453
-#define TIOCSERGWILD 0x5454
-#define TIOCSERSWILD 0x5455
-#define TIOCGLCKTRMIOS 0x5456
-#define TIOCSLCKTRMIOS 0x5457
-#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
-#define TIOCSERGETLSR 0x5459 /* Get line status register */
- /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
-#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */

#endif /* _ASM_PPC_IOCTLS_H */
diff -ruHpN -X badboys linux-2.1.80-clean/include/asm-sparc/ioctls.h linux-2.1.80-ioctl/include/asm-sparc/ioctls.h
--- linux-2.1.80-clean/include/asm-sparc/ioctls.h Thu Dec 4 16:09:01 1997
+++ linux-2.1.80-ioctl/include/asm-sparc/ioctls.h Fri Jan 23 09:08:57 1998
@@ -3,6 +3,9 @@

#include <asm/ioctl.h>

+/* Linux specific, no SunOS equivalent. */
+#include <linux/ioctl/ioctls.h>
+
/* Big T */
#define TCGETA _IOR('T', 1, struct termio)
#define TCSETA _IOW('T', 2, struct termio)
@@ -90,22 +93,6 @@
#define __TCGETSTAT _IO('T', 200) /* Rutgers specific */
#define __TCSETSTAT _IO('T', 201) /* Rutgers specific */

-/* Linux specific, no SunOS equivalent. */
-#define TIOCLINUX 0x541C
-#define TIOCGSERIAL 0x541E
-#define TIOCSSERIAL 0x541F
-#define TCSBRKP 0x5425
-#define TIOCTTYGSTRUCT 0x5426
-#define TIOCSERCONFIG 0x5453
-#define TIOCSERGWILD 0x5454
-#define TIOCSERSWILD 0x5455
-#define TIOCGLCKTRMIOS 0x5456
-#define TIOCSLCKTRMIOS 0x5457
-#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
-#define TIOCSERGETLSR 0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
/* Kernel definitions */
#ifdef __KERNEL__
#define TIOCGETC __TIOCGETC
@@ -116,14 +103,5 @@
#define TIOCSETN __TIOCSETN
#define TIOCSETC __TIOCSETC
#endif
-
-/* Used for packet mode */
-#define TIOCPKT_DATA 0
-#define TIOCPKT_FLUSHREAD 1
-#define TIOCPKT_FLUSHWRITE 2
-#define TIOCPKT_STOP 4
-#define TIOCPKT_START 8
-#define TIOCPKT_NOSTOP 16
-#define TIOCPKT_DOSTOP 32

#endif /* !(_ASM_SPARC_IOCTLS_H) */
diff -ruHpN -X badboys linux-2.1.80-clean/include/asm-sparc64/ioctls.h linux-2.1.80-ioctl/include/asm-sparc64/ioctls.h
--- linux-2.1.80-clean/include/asm-sparc64/ioctls.h Mon Jan 12 18:15:58 1998
+++ linux-2.1.80-ioctl/include/asm-sparc64/ioctls.h Fri Jan 23 09:09:14 1998
@@ -4,6 +4,9 @@

#include <asm/ioctl.h>

+/* Linux specific, no SunOS equivalent. */
+#include <linux/ioctl/ioctls.h>
+
/* Big T */
#define TCGETA _IOR('T', 1, struct termio)
#define TCSETA _IOW('T', 2, struct termio)
@@ -91,24 +94,6 @@
#define __TCGETSTAT _IO('T', 200) /* Rutgers specific */
#define __TCSETSTAT _IO('T', 201) /* Rutgers specific */

-/* Linux specific, no SunOS equivalent. */
-#define TIOCLINUX 0x541C
-#define TIOCGSERIAL 0x541E
-#define TIOCSSERIAL 0x541F
-#define TCSBRKP 0x5425
-#define TIOCTTYGSTRUCT 0x5426
-#define TIOCSERCONFIG 0x5453
-#define TIOCSERGWILD 0x5454
-#define TIOCSERSWILD 0x5455
-#define TIOCGLCKTRMIOS 0x5456
-#define TIOCSLCKTRMIOS 0x5457
-#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
-#define TIOCSERGETLSR 0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-#define TIOCMIWAIT 0x545C /* Wait for change on serial input line(s) */
-#define TIOCGICOUNT 0x545D /* Read serial port inline interrupt counts */
-
/* Kernel definitions */
#ifdef __KERNEL__
#define TIOCGETC __TIOCGETC
@@ -119,14 +104,5 @@
#define TIOCSETN __TIOCSETN
#define TIOCSETC __TIOCSETC
#endif
-
-/* Used for packet mode */
-#define TIOCPKT_DATA 0
-#define TIOCPKT_FLUSHREAD 1
-#define TIOCPKT_FLUSHWRITE 2
-#define TIOCPKT_STOP 4
-#define TIOCPKT_START 8
-#define TIOCPKT_NOSTOP 16
-#define TIOCPKT_DOSTOP 32

#endif /* !(_ASM_SPARC64_IOCTLS_H) */
diff -ruHpN -X badboys linux-2.1.80-clean/include/linux/ioctl/ioctls.h linux-2.1.80-ioctl/include/linux/ioctl/ioctls.h
--- linux-2.1.80-clean/include/linux/ioctl/ioctls.h Wed Dec 31 19:00:00 1969
+++ linux-2.1.80-ioctl/include/linux/ioctl/ioctls.h Fri Jan 23 07:56:19 1998
@@ -0,0 +1,109 @@
+/* asm-generic/ioctls.h --- Linux ioctls that most architectures agree on.
+ *
+ * Sifted by C. Scott Ananian <cananian@alumni.princeton.edu> 23-Jan-1998
+ */
+
+/* We have definitions used by i386, m68k, ALPHA, ARM, and PPC in here.
+ * MIPS has very little in common with the other architectures, so it omitted.
+ * ALPHA and PPC are a little bit different from the others.
+ * Sun machines are way different.
+ */
+
+/* 0x54 is just a magic number to make these relatively unique ('T') */
+
+#ifndef _ASM_GENERIC_IOCTLS_H
+#define _ASM_GENERIC_IOCTLS_H
+
+#if !defined(_ASM_SPARC_IOCTLS_H) && !defined(_ASM_SPARC64_IOCTLS_H)
+# if !defined(_ASM_ALPHA_IOCTLS_H) && !defined(_ASM_PPC_IOCTLS_H)
+# define TCGETS _IOC(0,'T',0x01,0)
+# define TCSETS _IOC(0,'T',0x02,0)
+# define TCSETSW _IOC(0,'T',0x03,0)
+# define TCSETSF _IOC(0,'T',0x04,0)
+# define TCGETA _IOC(0,'T',0x05,0)
+# define TCSETA _IOC(0,'T',0x06,0)
+# define TCSETAW _IOC(0,'T',0x07,0)
+# define TCSETAF _IOC(0,'T',0x08,0)
+# define TCSBRK _IOC(0,'T',0x09,0)
+# define TCXONC _IOC(0,'T',0x0A,0)
+# define TCFLSH _IOC(0,'T',0x0B,0)
+# define TIOCEXCL _IOC(0,'T',0x0C,0)
+# define TIOCNXCL _IOC(0,'T',0x0D,0)
+# define TIOCSCTTY _IOC(0,'T',0x0E,0)
+# define TIOCGPGRP _IOC(0,'T',0x0F,0)
+# define TIOCSPGRP _IOC(0,'T',0x10,0)
+# define TIOCOUTQ _IOC(0,'T',0x11,0)
+# endif /* !ALPHA && !PPC */
+# define TIOCSTI _IOC(0,'T',0x12,0)
+# if !defined(_ASM_ALPHA_IOCTLS_H) && !defined(_ASM_PPC_IOCTLS_H)
+# define TIOCGWINSZ _IOC(0,'T',0x13,0)
+# define TIOCSWINSZ _IOC(0,'T',0x14,0)
+# endif /* !ALPHA && !PPC */
+# define TIOCMGET _IOC(0,'T',0x15,0)
+# define TIOCMBIS _IOC(0,'T',0x16,0)
+# define TIOCMBIC _IOC(0,'T',0x17,0)
+# define TIOCMSET _IOC(0,'T',0x18,0)
+# define TIOCGSOFTCAR _IOC(0,'T',0x19,0)
+# define TIOCSSOFTCAR _IOC(0,'T',0x1A,0)
+# if !defined(_ASM_ALPHA_IOCTLS_H) && !defined(_ASM_PPC_IOCTLS_H)
+# define FIONREAD _IOC(0,'T',0x1B,0)
+# define TIOCINQ FIONREAD
+# endif /* !ALPHA && !PPC */
+#endif /* !SPARC && !SPARC64 */
+#define TIOCLINUX _IOC(0,'T',0x1C,0)
+#if !defined(_ASM_SPARC_IOCTLS_H) && !defined(_ASM_SPARC64_IOCTLS_H)
+# define TIOCCONS _IOC(0,'T',0x1D,0)
+#endif /* !SPARC && !SPARC64 */
+#define TIOCGSERIAL _IOC(0,'T',0x1E,0)
+#define TIOCSSERIAL _IOC(0,'T',0x1F,0)
+
+#if !defined(_ASM_SPARC_IOCTLS_H) && !defined(_ASM_SPARC64_IOCTLS_H)
+# define TIOCPKT _IOC(0,'T',0x20,0)
+# if !defined(_ASM_ALPHA_IOCTLS_H) && !defined(_ASM_PPC_IOCTLS_H)
+# define FIONBIO _IOC(0,'T',0x21,0)
+# endif /* !ALPHA && !PPC */
+# define TIOCNOTTY _IOC(0,'T',0x22,0)
+# define TIOCSETD _IOC(0,'T',0x23,0)
+# define TIOCGETD _IOC(0,'T',0x24,0)
+#endif /* !SPARC && !SPARC64 */
+#define TCSBRKP _IOC(0,'T',0x25,0) /* Needed for POSIX tcsendbreak()*/
+#define TIOCTTYGSTRUCT _IOC(0,'T',0x26,0) /* For debugging only */
+#if !defined(_ASM_SPARC_IOCTLS_H) && !defined(_ASM_SPARC64_IOCTLS_H)
+# define TIOCSBRK _IOC(0,'T',0x27,0) /* BSD compatibility */
+# define TIOCCBRK _IOC(0,'T',0x28,0) /* BSD compatibility */
+# define TIOCGSID _IOC(0,'T',0x29,0) /* Return the session ID of FD */
+#endif /* !SPARC && !SPARC64 */
+
+#if !defined(_ASM_SPARC_IOCTLS_H) && !defined(_ASM_SPARC64_IOCTLS_H)
+# if !defined(_ASM_ALPHA_IOCTLS_H) && !defined(_ASM_PPC_IOCTLS_H)
+/* these numbers need to be adjusted. */
+# define FIONCLEX _IOC(0,'T',0x50,0)
+# define FIOCLEX _IOC(0,'T',0x51,0)
+# define FIOASYNC _IOC(0,'T',0x52,0)
+# endif /* !ALPHA && !PPC */
+#endif /* !SPARC && !SPARC64 */
+#define TIOCSERCONFIG _IOC(0,'T',0x53,0)
+#define TIOCSERGWILD _IOC(0,'T',0x54,0)
+#define TIOCSERSWILD _IOC(0,'T',0x55,0)
+#define TIOCGLCKTRMIOS _IOC(0,'T',0x56,0)
+#define TIOCSLCKTRMIOS _IOC(0,'T',0x57,0)
+#define TIOCSERGSTRUCT _IOC(0,'T',0x58,0) /* For debugging only */
+#define TIOCSERGETLSR _IOC(0,'T',0x59,0) /* Get line status register */
+#define TIOCSERGETMULTI _IOC(0,'T',0x5A,0) /* Get multiport config */
+#define TIOCSERSETMULTI _IOC(0,'T',0x5B,0) /* Set multiport config */
+
+#define TIOCMIWAIT _IOC(0,'T',0x5C,0) /* wait for a change on serial input line(s) */
+#define TIOCGICOUNT _IOC(0,'T',0x5D,0) /* read serial port inline interrupt counts */
+
+/* Used for packet mode */
+#define TIOCPKT_DATA 0
+#define TIOCPKT_FLUSHREAD 1
+#define TIOCPKT_FLUSHWRITE 2
+#define TIOCPKT_STOP 4
+#define TIOCPKT_START 8
+#define TIOCPKT_NOSTOP 16
+#define TIOCPKT_DOSTOP 32
+
+#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
+
+#endif /* _ASM_GENERIC_IOCTLS_H */