Patch: ioctl MESS!

C. Scott Ananian (cananian@lcs.mit.edu)
Fri, 23 Jan 1998 02:07:59 -0500 (EST)


Enclosed is a patch to remove as much as possible of the duplicated ioctl
definitions into asm-generic. Currently, if one wants to add an ioctl to
the kernel, one has to patch asm-*/ioctls.h for every architecture
supported -- invariably missing one, or causing integration problems when
new architectures are merged into the standard kernel. By moving as many
ioctls as possible to asm-generic/ioctls.h, I attempt to limit the code
spread.

Please comment on this patch. I've only tested it on i386, so any reports
from other architectures would be appreciated. Any comments on how to do
this more effectively would be useful, too -- perhaps we want a massive
table and a macro to select the right value based on architecture?
Something like:

#define MY_IOCTL IOCTL_SWITCH(alpha_value, mips_value, ....);

Are there common definitions in the ioctl code that I have missed? Is
there a good reason why something like this should not be done?
Comments are requested.
--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/include/asm-alpha/ioctls.h
--- linux-2.1.80-clean/include/asm-alpha/ioctls.h Thu Dec 4 16:09:01 1997
+++ linux/include/asm-alpha/ioctls.h Fri Jan 23 00:59:34 1998
@@ -2,6 +2,7 @@
#define _ASM_ALPHA_IOCTLS_H

#include <asm/ioctl.h>
+#include <asm-generic/ioctls.h>

#define FIOCLEX _IO('f', 1)
#define FIONCLEX _IO('f', 2)
@@ -45,11 +46,6 @@
#define TIOCNXCL 0x540D
#define TIOCSCTTY 0x540E

-#define TIOCSTI 0x5412
-#define TIOCMGET 0x5415
-#define TIOCMBIS 0x5416
-#define TIOCMBIC 0x5417
-#define TIOCMSET 0x5418
# 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/include/asm-arm/ioctls.h
--- linux-2.1.80-clean/include/asm-arm/ioctls.h Tue Jan 20 19:39:42 1998
+++ linux/include/asm-arm/ioctls.h Fri Jan 23 01:01:45 1998
@@ -3,76 +3,8 @@

#include <asm/ioctl.h>

-/* 0x54 is just a magic number to make these relatively unique ('T') */
+#include <asm-generic/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-generic/ioctls.h linux/include/asm-generic/ioctls.h
--- linux-2.1.80-clean/include/asm-generic/ioctls.h Wed Dec 31 19:00:00 1969
+++ linux/include/asm-generic/ioctls.h Fri Jan 23 01:30:59 1998
@@ -0,0 +1,108 @@
+/* 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 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
+# endif /* !ALPHA && !PPC */
+# define TIOCSTI 0x5412
+# if !defined(_ASM_ALPHA_IOCTLS_H) && !defined(_ASM_PPC_IOCTLS_H)
+# define TIOCGWINSZ 0x5413
+# define TIOCSWINSZ 0x5414
+# endif /* !ALPHA && !PPC */
+# define TIOCMGET 0x5415
+# define TIOCMBIS 0x5416
+# define TIOCMBIC 0x5417
+# define TIOCMSET 0x5418
+# define TIOCGSOFTCAR 0x5419
+# define TIOCSSOFTCAR 0x541A
+# if !defined(_ASM_ALPHA_IOCTLS_H) && !defined(_ASM_PPC_IOCTLS_H)
+# define FIONREAD 0x541B
+# define TIOCINQ FIONREAD
+# endif /* !ALPHA && !PPC */
+#endif /* !SPARC && !SPARC64 */
+#define TIOCLINUX 0x541C
+#if !defined(_ASM_SPARC_IOCTLS_H) && !defined(_ASM_SPARC64_IOCTLS_H)
+# define TIOCCONS 0x541D
+#endif /* !SPARC && !SPARC64 */
+#define TIOCGSERIAL 0x541E
+#define TIOCSSERIAL 0x541F
+
+#if !defined(_ASM_SPARC_IOCTLS_H) && !defined(_ASM_SPARC64_IOCTLS_H)
+# define TIOCPKT 0x5420
+# if !defined(_ASM_ALPHA_IOCTLS_H) && !defined(_ASM_PPC_IOCTLS_H)
+# define FIONBIO 0x5421
+# endif /* !ALPHA && !PPC */
+# define TIOCNOTTY 0x5422
+# define TIOCSETD 0x5423
+# define TIOCGETD 0x5424
+#endif /* !SPARC && !SPARC64 */
+#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
+#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
+#if !defined(_ASM_SPARC_IOCTLS_H) && !defined(_ASM_SPARC64_IOCTLS_H)
+# define TIOCSBRK 0x5427 /* BSD compatibility */
+# define TIOCCBRK 0x5428 /* BSD compatibility */
+# define TIOCGSID 0x5429 /* 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)
+# define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
+# define FIOCLEX 0x5451
+# define FIOASYNC 0x5452
+# endif /* !ALPHA && !PPC */
+#endif /* !SPARC && !SPARC64 */
+#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 */
+
+#endif /* _ASM_GENERIC_IOCTLS_H */
diff -ruHpN -X badboys linux-2.1.80-clean/include/asm-i386/ioctls.h linux/include/asm-i386/ioctls.h
--- linux-2.1.80-clean/include/asm-i386/ioctls.h Thu Dec 4 16:09:01 1997
+++ linux/include/asm-i386/ioctls.h Fri Jan 23 01:02:30 1998
@@ -3,76 +3,8 @@

#include <asm/ioctl.h>

-/* 0x54 is just a magic number to make these relatively unique ('T') */
+#include <asm-generic/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/include/asm-m68k/ioctls.h
--- linux-2.1.80-clean/include/asm-m68k/ioctls.h Thu Dec 4 16:09:01 1997
+++ linux/include/asm-m68k/ioctls.h Fri Jan 23 01:03:10 1998
@@ -3,76 +3,8 @@

#include <asm/ioctl.h>

-/* 0x54 is just a magic number to make these relatively unique ('T') */
+#include <asm-generic/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-ppc/ioctls.h linux/include/asm-ppc/ioctls.h
--- linux-2.1.80-clean/include/asm-ppc/ioctls.h Thu Dec 4 16:09:01 1997
+++ linux/include/asm-ppc/ioctls.h Fri Jan 23 01:13:01 1998
@@ -3,6 +3,8 @@

#include <asm/ioctl.h>

+#include <asm-generic/ioctls.h>
+
#define FIOCLEX _IO('f', 1)
#define FIONCLEX _IO('f', 2)
#define FIOASYNC _IOW('f', 125, int)
@@ -45,11 +47,6 @@
#define TIOCNXCL 0x540D
#define TIOCSCTTY 0x540E

-#define TIOCSTI 0x5412
-#define TIOCMGET 0x5415
-#define TIOCMBIS 0x5416
-#define TIOCMBIC 0x5417
-#define TIOCMSET 0x5418
# 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/include/asm-sparc/ioctls.h
--- linux-2.1.80-clean/include/asm-sparc/ioctls.h Thu Dec 4 16:09:01 1997
+++ linux/include/asm-sparc/ioctls.h Fri Jan 23 01:21:54 1998
@@ -3,6 +3,9 @@

#include <asm/ioctl.h>

+/* Linux specific, no SunOS equivalent. */
+#include <asm-generic/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/include/asm-sparc64/ioctls.h
--- linux-2.1.80-clean/include/asm-sparc64/ioctls.h Mon Jan 12 18:15:58 1998
+++ linux/include/asm-sparc64/ioctls.h Fri Jan 23 01:23:34 1998
@@ -4,6 +4,9 @@

#include <asm/ioctl.h>

+/* Linux specific, no SunOS equivalent. */
+#include <asm-generic/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) */