diff options
author | ed <ed@FreeBSD.org> | 2008-06-14 10:42:18 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2008-06-14 10:42:18 +0000 |
commit | e735353f8de6769a184142b91eb1ea97ad1d3570 (patch) | |
tree | 3ab73a1426a4f7b9dd4c11f9756cde6ecfa06eff | |
parent | 7782c49376b2a6dea979e4c270f324a1771d1a7a (diff) | |
download | FreeBSD-src-e735353f8de6769a184142b91eb1ea97ad1d3570.zip FreeBSD-src-e735353f8de6769a184142b91eb1ea97ad1d3570.tar.gz |
Turn sgtty into a binary-only compatibility interface.
sgtty was the original interface to configure terminal attributes on my
UNIX-like operating systems. It has been deprecated by the POSIX termios
interface, which is implemented in almost any modern system.
An advantage of turning this into a binary compatibility interface, is
that we can now eventually remove the COMPAT_43TTY switch from kernel
configurations. This removes many ioctl()'s from the TTY layer.
While there, increase the __FreeBSD_version, which may be useful for the
people working on the Ports tree.
Reviewed by: kib
Approved by: philip (mentor)
-rw-r--r-- | ObsoleteFiles.inc | 5 | ||||
-rw-r--r-- | include/sgtty.h | 42 | ||||
-rw-r--r-- | lib/libcompat/4.1/gtty.c | 52 | ||||
-rw-r--r-- | lib/libcompat/4.1/stty.3 | 94 | ||||
-rw-r--r-- | lib/libcompat/4.1/stty.c | 52 | ||||
-rw-r--r-- | lib/libcompat/Makefile | 5 | ||||
-rw-r--r-- | sys/sys/ioctl.h | 11 | ||||
-rw-r--r-- | sys/sys/ioctl_compat.h | 22 | ||||
-rw-r--r-- | sys/sys/param.h | 2 | ||||
-rw-r--r-- | sys/sys/ttychars.h | 62 | ||||
-rw-r--r-- | sys/sys/ttydev.h | 62 |
11 files changed, 18 insertions, 391 deletions
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 969fef3..bba36bb 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -14,6 +14,11 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20080614: sgtty removed +OLD_FILES+=usr/include/sys/ttychars.h +OLD_FILES+=usr/include/sys/ttydev.h +OLD_FILES+=usr/share/man/man3/gtty.3.gz +OLD_FILES+=usr/share/man/man3/stty.3.gz # 20080609: gpt(8) removed OLD_FILES+=sbin/gpt OLD_FILES+=usr/share/man/man8/gpt.8.gz diff --git a/include/sgtty.h b/include/sgtty.h index 723c69d..254b97f 100644 --- a/include/sgtty.h +++ b/include/sgtty.h @@ -1,39 +1,3 @@ -/* - * Copyright (c) 1985, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)sgtty.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef USE_OLD_TTY -#define USE_OLD_TTY -#endif -#include <sys/ioctl.h> +/* $FreeBSD$ */ +#error "The sgtty interface has been replaced by termios(4)" +#error "Try to use <sys/ioctl.h> or migrate to <termios.h>" diff --git a/lib/libcompat/4.1/gtty.c b/lib/libcompat/4.1/gtty.c deleted file mode 100644 index 524f1a6..0000000 --- a/lib/libcompat/4.1/gtty.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1994 Christopher G. Demetriou - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christopher G. Demetriou. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef lint -static char rcsid[] = "$FreeBSD$"; -#endif /* not lint */ - -#include <sgtty.h> - -/* - * Get tty modes. - * This was defined in ioctl_compat.h as: - * #define gtty(fd, tty) ioctl(fd, TIOCGETP, tty) - */ - -#undef gtty - -int -gtty(fd, tty) - int fd; - struct sgttyb *tty; -{ - - return (ioctl(fd, TIOCGETP, tty)); -} diff --git a/lib/libcompat/4.1/stty.3 b/lib/libcompat/4.1/stty.3 deleted file mode 100644 index 1396957..0000000 --- a/lib/libcompat/4.1/stty.3 +++ /dev/null @@ -1,94 +0,0 @@ -.\" Copyright (c) 1983, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)stty.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt STTY 3 -.Os -.Sh NAME -.Nm stty , -.Nm gtty -.Nd set and get terminal state (defunct) -.Sh LIBRARY -.Lb libcompat -.Sh SYNOPSIS -.In sgtty.h -.Ft int -.Fn stty "int fd" "struct sgttyb *buf" -.Ft int -.Fn gtty "int fd" "struct sgttyb *buf" -.Sh DESCRIPTION -.Bf -symbolic -These interfaces are obsoleted by -.Xr ioctl 2 . -.Ef -.Pp -The -.Fn stty -function -sets the state of the terminal associated with -.Fa fd . -The -.Fn gtty -function -retrieves the state of the terminal associated -with -.Fa fd . -To set the state of a terminal the call must have -write permission. -.Pp -The -.Fn stty -call is actually -.Ql ioctl(fd, TIOCSETP, buf) , -while -the -.Fn gtty -call is -.Ql ioctl(fd, TIOCGETP, buf) . -See -.Xr ioctl 2 -and -.Xr tty 4 -for an explanation. -.Sh DIAGNOSTICS -If the call is successful 0 is returned, otherwise \-1 is -returned and the global variable -.Va errno -contains the reason for the failure. -.Sh SEE ALSO -.Xr ioctl 2 , -.Xr tty 4 -.Sh HISTORY -The -.Fn stty -and -.Fn gtty -functions appeared in -.Bx 4.2 . diff --git a/lib/libcompat/4.1/stty.c b/lib/libcompat/4.1/stty.c deleted file mode 100644 index cf0137f..0000000 --- a/lib/libcompat/4.1/stty.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1994 Christopher G. Demetriou - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christopher G. Demetriou. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef lint -static char rcsid[] = "$FreeBSD$"; -#endif /* not lint */ - -#include <sgtty.h> - -/* - * Set tty modes. - * This was defined in ioctl_compat.h as: - * #define stty(fd, tty) ioctl(fd, TIOCSETP, tty) - */ - -#undef stty - -int -stty(fd, tty) - int fd; - struct sgttyb *tty; -{ - - return (ioctl(fd, TIOCSETP, tty)); -} diff --git a/lib/libcompat/Makefile b/lib/libcompat/Makefile index b9b174d..106bab9 100644 --- a/lib/libcompat/Makefile +++ b/lib/libcompat/Makefile @@ -12,12 +12,11 @@ NO_PIC= # compat 4.1 sources # XXX MISSING: tell.c -SRCS+= ascftime.c cftime.c ftime.c getpw.c gtty.c stty.c +SRCS+= ascftime.c cftime.c ftime.c getpw.c -MAN+= 4.1/ftime.3 4.1/getpw.3 4.1/stty.3 +MAN+= 4.1/ftime.3 4.1/getpw.3 MAN+= 4.1/cftime.3 -MLINKS+=stty.3 gtty.3 MLINKS+=cftime.3 ascftime.3 # compat 4.3 sources diff --git a/sys/sys/ioctl.h b/sys/sys/ioctl.h index 7abb328..6702409 100644 --- a/sys/sys/ioctl.h +++ b/sys/sys/ioctl.h @@ -69,14 +69,3 @@ struct ttysize { #include <sys/sockio.h> #endif /* !_SYS_IOCTL_H_ */ - -/* - * Keep outside _SYS_IOCTL_H_ - * Compatibility with old terminal driver - * - * Source level -> #define USE_OLD_TTY - * Kernel level -> options COMPAT_43TTY - */ -#if defined(USE_OLD_TTY) || defined(COMPAT_43TTY) -#include <sys/ioctl_compat.h> -#endif diff --git a/sys/sys/ioctl_compat.h b/sys/sys/ioctl_compat.h index a8269ff..9be7dd2 100644 --- a/sys/sys/ioctl_compat.h +++ b/sys/sys/ioctl_compat.h @@ -38,12 +38,7 @@ #ifndef _SYS_IOCTL_COMPAT_H_ #define _SYS_IOCTL_COMPAT_H_ -#include <sys/ttychars.h> -#include <sys/ttydev.h> - -#ifdef USE_OLD_TTY -#warning "Old BSD tty API used and depends on COMPAT_43TTY. Use termios.h instead" -#endif +#ifdef _KERNEL struct tchars { char t_intrc; /* interrupt */ @@ -77,15 +72,8 @@ struct sgttyb { }; #endif -#ifdef USE_OLD_TTY -# undef TIOCGETD -# define TIOCGETD _IOR('t', 0, int) /* get line discipline */ -# undef TIOCSETD -# define TIOCSETD _IOW('t', 1, int) /* set line discipline */ -#else -# define OTIOCGETD _IOR('t', 0, int) /* get line discipline */ -# define OTIOCSETD _IOW('t', 1, int) /* set line discipline */ -#endif +#define OTIOCGETD _IOR('t', 0, int) /* get line discipline */ +#define OTIOCSETD _IOW('t', 1, int) /* set line discipline */ #define TIOCHPCL _IO('t', 2) /* hang up on last close */ #define TIOCGETP _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */ #define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */ @@ -161,6 +149,10 @@ struct sgttyb { #define TIOCSLTC _IOW('t',117,struct ltchars)/* set local special chars*/ #define TIOCGLTC _IOR('t',116,struct ltchars)/* get local special chars*/ #define OTIOCCONS _IO('t', 98) /* for hp300 -- sans int arg */ + +#endif /* _KERNEL */ + +/* XXX publish these so stty(1) can still report them */ #define OTTYDISC 0 #define NETLDISC 1 #define NTTYDISC 2 diff --git a/sys/sys/param.h b/sys/sys/param.h index 5db3146..98d153a 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800038 /* Master, propagated to newvers */ +#define __FreeBSD_version 800039 /* Master, propagated to newvers */ #ifndef LOCORE #include <sys/types.h> diff --git a/sys/sys/ttychars.h b/sys/sys/ttychars.h deleted file mode 100644 index 56a55d4..0000000 --- a/sys/sys/ttychars.h +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ttychars.h 8.2 (Berkeley) 1/4/94 - * $FreeBSD$ - */ - -#ifndef _SYS_TTYCHARS_H_ -#define _SYS_TTYCHARS_H_ - -/* - * 4.3 COMPATIBILITY FILE - * - * User visible structures and constants related to terminal handling. - */ - -struct ttychars { - char tc_erase; /* erase last character */ - char tc_kill; /* erase entire line */ - char tc_intrc; /* interrupt */ - char tc_quitc; /* quit */ - char tc_startc; /* start output */ - char tc_stopc; /* stop output */ - char tc_eofc; /* end-of-file */ - char tc_brkc; /* input delimiter (like nl) */ - char tc_suspc; /* stop process signal */ - char tc_dsuspc; /* delayed stop process signal */ - char tc_rprntc; /* reprint line */ - char tc_flushc; /* flush output (toggles) */ - char tc_werasc; /* word erase */ - char tc_lnextc; /* literal next character */ -}; -#ifdef USE_OLD_TTY -#include <sys/ttydefaults.h> /* to pick up character defaults */ -#endif - -#endif /* !_SYS_TTYCHARS_H_ */ diff --git a/sys/sys/ttydev.h b/sys/sys/ttydev.h deleted file mode 100644 index d6d6b4c..0000000 --- a/sys/sys/ttydev.h +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ttydev.h 8.2 (Berkeley) 1/4/94 - * $FreeBSD$ - */ - -/* COMPATIBILITY HEADER FILE */ - -#ifndef _SYS_TTYDEV_H_ -#define _SYS_TTYDEV_H_ - -#ifdef USE_OLD_TTY -#define B0 0 -#define B50 1 -#define B75 2 -#define B110 3 -#define B134 4 -#define B150 5 -#define B200 6 -#define B300 7 -#define B600 8 -#define B1200 9 -#define B1800 10 -#define B2400 11 -#define B4800 12 -#define B9600 13 -#define EXTA 14 -#define EXTB 15 -#define B57600 16 -#define B115200 17 -#define B230400 18 -#define B460800 19 -#define B921600 20 -#endif /* USE_OLD_TTY */ - -#endif /* !_SYS_TTYDEV_H_ */ |