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)
This commit is contained in:
ed 2008-06-14 10:42:18 +00:00
parent 7782c49376
commit e735353f8d
11 changed files with 18 additions and 391 deletions

View File

@ -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

View File

@ -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>"

View File

@ -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));
}

View File

@ -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 .

View File

@ -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));
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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_ */

View File

@ -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_ */