Remove unused sysdeps/unix/sysv termio code.

This commit is contained in:
Joseph Myers 2012-04-20 17:00:40 +00:00
parent e7740d31ee
commit ff1962a397
11 changed files with 15 additions and 787 deletions

View File

@ -1,5 +1,19 @@
2012-04-20 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/Makefile [termio.h not in sysdep_headers]
(sysdep_headers): Remove variable.
[termio.h not in sysdep_headers] (generated): Likewise.
[termio.h not in sysdep_headers] ($(objpfx)termio.h): Remove rule.
* sysdeps/unix/sysv/sysv_termio.h: Remove file.
* sysdeps/unix/sysv/tcdrain.c: Likewise.
* sysdeps/unix/sysv/tcflow.c: Likewise.
* sysdeps/unix/sysv/tcflush.c: Likewise.
* sysdeps/unix/sysv/tcgetattr.c: Likewise.
* sysdeps/unix/sysv/tcgetpgrp.c: Likewise.
* sysdeps/unix/sysv/tcsendbrk.c: Likewise.
* sysdeps/unix/sysv/tcsetattr.c: Likewise.
* sysdeps/unix/sysv/tcsetpgrp.c: Likewise.
* sysdeps/unix/siglist.c: Remove file.
* sysdeps/unix/getppid.S: Remove file.

View File

@ -1,4 +1,4 @@
# Copyright (C) 1992, 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
# Copyright (C) 1992-2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@ -15,27 +15,5 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
ifeq ($(subdir),termios)
ifeq (,$(filter termio.h,$(sysdep_headers)))
sysdep_headers := $(sysdep_headers) termio.h
generated := $(generated) termio.h
# termio.h is just like sysv_termio.h except it uses the same names for
# everything that System V termio does. sysv_termio.h is necessary to
# include in __tcgetatr.c et al, because some of the names in termio.h
# conflict with termios.h. The C library doesn't actually use termio.h,
# but we generate it for those application programs which use it.
$(objpfx)termio.h: $(..)sysdeps/unix/sysv/sysv_termio.h
sed < $< > $@-tmp \
-e 's/_SYSV_//' \
-e 's/^#define[ ]*_T/#define T/'\
-e 's/__sysv_termio/termio/'
mv $@-tmp $@
endif
endif
# In SYSV style archives the symbol table member has an empty name.
ar-symtab-name =

View File

@ -1,154 +0,0 @@
/* Copyright (C) 1992, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* In various parts of this file we define the System V values for
things as _SYSV_<whatever>. Those are the values that System V
uses for termio, and also (SVR4) termios. Not necessarily the
same as the GNU termios that the library user sees. */
/* Number of elements of c_cc. termio only. */
#define _SYSV_NCC 8
#define _SYSV_VINTR 0
#define _SYSV_VQUIT 1
#define _SYSV_VERASE 2
#define _SYSV_VKILL 3
#define _SYSV_VEOF 4
/* This field means VEOF if ICANON, VMIN if not. */
#define _SYSV_VMIN 4
#define _SYSV_VEOL 5
/* This field means VEOL if ICANON, VTIME if not. */
#define _SYSV_VTIME 5
#define _SYSV_VEOL2 6
/* Flags in c_iflag. */
#define _SYSV_IGNBRK 1
#define _SYSV_BRKINT 2
#define _SYSV_IGNPAR 4
#define _SYSV_PARMRK 8
#define _SYSV_INPCK 0x10
#define _SYSV_ISTRIP 0x20
#define _SYSV_INLCR 0x40
#define _SYSV_IGNCR 0x80
#define _SYSV_ICRNL 0x100
#define _SYSV_IUCLC 0x200
#define _SYSV_IXON 0x400
#define _SYSV_IXANY 0x800
#define _SYSV_IXOFF 0x1000
#define _SYSV_IMAXBEL 0x2000
/* Flags in c_cflag. */
#define _SYSV_CBAUD 0xf
#define _SYSV_CIBAUD 0xf0000 /* termios only. */
#define _SYSV_IBSHIFT 16
/* Values for CBAUD and CIBAUD. */
#define _SYSV_B0 0
#define _SYSV_B50 1
#define _SYSV_B75 2
#define _SYSV_B110 3
#define _SYSV_B134 4
#define _SYSV_B150 5
#define _SYSV_B200 6
#define _SYSV_B300 7
#define _SYSV_B600 8
#define _SYSV_B1200 9
#define _SYSV_B1800 10
#define _SYSV_B2400 11
#define _SYSV_B4800 12
#define _SYSV_B9600 13
#define _SYSV_B19200 14
#define _SYSV_B38400 15
#define _SYSV_CS5 0
#define _SYSV_CS6 0x10
#define _SYSV_CS7 0x20
#define _SYSV_CS8 0x30
#define _SYSV_CSIZE 0x30
#define _SYSV_CSTOPB 0x40
#define _SYSV_CREAD 0x80
#define _SYSV_PARENB 0x100
#define _SYSV_PARODD 0x200
#define _SYSV_HUPCL 0x400
#define _SYSV_CLOCAL 0x800
/* Flags in c_lflag. */
#define _SYSV_ISIG 1
#define _SYSV_ICANON 2
#define _SYSV_ECHO 8
#define _SYSV_ECHOE 0x10
#define _SYSV_ECHOK 0x20
#define _SYSV_ECHONL 0x40
#define _SYSV_NOFLSH 0x80
#define _SYSV_TOSTOP 0x100
#define _SYSV_ECHOCTL 0x200
#define _SYSV_ECHOPRT 0x400
#define _SYSV_ECHOKE 0x800
#define _SYSV_FLUSHO 0x2000
#define _SYSV_PENDIN 0x4000
#define _SYSV_IEXTEN 0x8000
/* Flags in c_oflag. */
#define _SYSV_OPOST 1
#define _SYSV_OLCUC 2
#define _SYSV_ONLCR 4
#define _SYSV_NLDLY 0x100
#define _SYSV_NL0 0
#define _SYSV_NL1 0x100
#define _SYSV_CRDLY 0x600
#define _SYSV_CR0 0
#define _SYSV_CR1 0x200
#define _SYSV_CR2 0x400
#define _SYSV_CR3 0x600
#define _SYSV_TABDLY 0x1800
#define _SYSV_TAB0 0
#define _SYSV_TAB1 0x0800
#define _SYSV_TAB2 0x1000
/* TAB3 is an obsolete name for XTABS. But we provide it since some
programs expect it to exist. */
#define _SYSV_TAB3 0x1800
#define _SYSV_XTABS 0x1800
#define _SYSV_BSDLY 0x2000
#define _SYSV_BS0 0
#define _SYSV_BS1 0x2000
#define _SYSV_VTDLY 0x4000
#define _SYSV_VT0 0
#define _SYSV_VT1 0x4000
#define _SYSV_FFDLY 0x8000
#define _SYSV_FF0 0
#define _SYSV_FF1 0x8000
/* ioctl's. */
#define _TCGETA 0x5401
#define _TCSETA 0x5402
#define _TCSETAW 0x5403
#define _TCSETAF 0x5404
#define _TCSBRK 0x5405
#define _TCXONC 0x5406
#define _TCFLSH 0x5407
#define _TIOCGPGRP 0x7414
#define _TIOCSPGRP 0x7415
struct __sysv_termio
{
unsigned short c_iflag;
unsigned short c_oflag;
unsigned short c_cflag;
unsigned short c_lflag;
char c_line;
unsigned char c_cc[_SYSV_NCC];
};

View File

@ -1,32 +0,0 @@
/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <errno.h>
#include <stddef.h>
#include <termios.h>
#include <unistd.h>
#include <sysv_termio.h>
#include <sys/ioctl.h>
/* Wait for pending output to be written on FD. */
int
__libc_tcdrain (int fd)
{
/* With an argument of 1, TCSBRK just waits for output to drain. */
return __ioctl (fd, _TCSBRK, 1);
}
weak_alias (__libc_tcdrain, tcdrain)

View File

@ -1,46 +0,0 @@
/* Copyright (C) 1992, 1996, 1997, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <errno.h>
#include <stddef.h>
#include <termios.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sysv_termio.h>
/* Suspend or restart transmission on FD. */
int
tcflow (fd, action)
int fd;
int action;
{
switch (action)
{
case TCOOFF:
return __ioctl (fd, _TCXONC, 0);
case TCOON:
return __ioctl (fd, _TCXONC, 1);
case TCIOFF:
return __ioctl (fd, _TCXONC, 2);
case TCION:
return __ioctl (fd, _TCXONC, 3);
default:
__set_errno (EINVAL);
return -1;
}
}

View File

@ -1,44 +0,0 @@
/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <errno.h>
#include <stddef.h>
#include <termios.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sysv_termio.h>
/* Flush pending data on FD. */
int
tcflush (fd, queue_selector)
int fd;
int queue_selector;
{
switch (queue_selector)
{
case TCIFLUSH:
return __ioctl (fd, _TCFLSH, 0);
case TCOFLUSH:
return __ioctl (fd, _TCFLSH, 1);
case TCIOFLUSH:
return __ioctl (fd, _TCFLSH, 2);
default:
__set_errno (EINVAL);
return -1;
}
}

View File

@ -1,170 +0,0 @@
/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <errno.h>
#include <stddef.h>
#include <sysv_termio.h>
#include <termios.h>
#include <sys/ioctl.h>
/* Put the state of FD into *TERMIOS_P. */
int
__tcgetattr (fd, termios_p)
int fd;
struct termios *termios_p;
{
struct __sysv_termio buf;
int termio_speed;
if (termios_p == NULL)
{
__set_errno (EINVAL);
return -1;
}
if (__ioctl (fd, _TCGETA, &buf) < 0)
return -1;
termio_speed = buf.c_cflag & _SYSV_CBAUD;
termios_p->__ospeed =
(termio_speed == _SYSV_B0 ? 0 :
termio_speed == _SYSV_B50 ? 50 :
termio_speed == _SYSV_B75 ? 75 :
termio_speed == _SYSV_B110 ? 110 :
termio_speed == _SYSV_B134 ? 134 :
termio_speed == _SYSV_B150 ? 150 :
termio_speed == _SYSV_B200 ? 200 :
termio_speed == _SYSV_B300 ? 300 :
termio_speed == _SYSV_B600 ? 600 :
termio_speed == _SYSV_B1200 ? 1200 :
termio_speed == _SYSV_B1800 ? 1800 :
termio_speed == _SYSV_B2400 ? 2400 :
termio_speed == _SYSV_B4800 ? 4800 :
termio_speed == _SYSV_B9600 ? 9600 :
termio_speed == _SYSV_B19200 ? 19200 :
termio_speed == _SYSV_B38400 ? 38400 :
-1);
termios_p->__ispeed = termios_p->__ospeed;
termios_p->c_iflag = 0;
if (buf.c_iflag & _SYSV_IGNBRK)
termios_p->c_iflag |= IGNBRK;
if (buf.c_iflag & _SYSV_BRKINT)
termios_p->c_iflag |= BRKINT;
if (buf.c_iflag & _SYSV_IGNPAR)
termios_p->c_iflag |= IGNPAR;
if (buf.c_iflag & _SYSV_PARMRK)
termios_p->c_iflag |= PARMRK;
if (buf.c_iflag & _SYSV_INPCK)
termios_p->c_iflag |= INPCK;
if (buf.c_iflag & _SYSV_ISTRIP)
termios_p->c_iflag |= ISTRIP;
if (buf.c_iflag & _SYSV_INLCR)
termios_p->c_iflag |= INLCR;
if (buf.c_iflag & _SYSV_IGNCR)
termios_p->c_iflag |= IGNCR;
if (buf.c_iflag & _SYSV_ICRNL)
termios_p->c_iflag |= ICRNL;
if (buf.c_iflag & _SYSV_IXON)
termios_p->c_iflag |= IXON;
if (buf.c_iflag & _SYSV_IXOFF)
termios_p->c_iflag |= IXOFF;
if (buf.c_iflag & _SYSV_IXANY)
termios_p->c_iflag |= IXANY;
if (buf.c_iflag & _SYSV_IMAXBEL)
termios_p->c_iflag |= IMAXBEL;
termios_p->c_oflag = 0;
if (buf.c_oflag & OPOST)
termios_p->c_oflag |= OPOST;
if (buf.c_oflag & ONLCR)
termios_p->c_oflag |= ONLCR;
termios_p->c_cflag = 0;
switch (buf.c_cflag & _SYSV_CSIZE)
{
case _SYSV_CS5:
termios_p->c_cflag |= CS5;
break;
case _SYSV_CS6:
termios_p->c_cflag |= CS6;
break;
case _SYSV_CS7:
termios_p->c_cflag |= CS7;
break;
case _SYSV_CS8:
termios_p->c_cflag |= CS8;
break;
}
if (buf.c_cflag & _SYSV_CSTOPB)
termios_p->c_cflag |= CSTOPB;
if (buf.c_cflag & _SYSV_CREAD)
termios_p->c_cflag |= CREAD;
if (buf.c_cflag & _SYSV_PARENB)
termios_p->c_cflag |= PARENB;
if (buf.c_cflag & _SYSV_PARODD)
termios_p->c_cflag |= PARODD;
if (buf.c_cflag & _SYSV_HUPCL)
termios_p->c_cflag |= HUPCL;
if (buf.c_cflag & _SYSV_CLOCAL)
termios_p->c_cflag |= CLOCAL;
termios_p->c_lflag = 0;
if (buf.c_lflag & _SYSV_ISIG)
termios_p->c_lflag |= _ISIG;
if (buf.c_lflag & _SYSV_ICANON)
termios_p->c_lflag |= _ICANON;
if (buf.c_lflag & _SYSV_ECHO)
termios_p->c_lflag |= _ECHO;
if (buf.c_lflag & _SYSV_ECHOE)
termios_p->c_lflag |= _ECHOE;
if (buf.c_lflag & _SYSV_ECHOK)
termios_p->c_lflag |= _ECHOK;
if (buf.c_lflag & _SYSV_ECHONL)
termios_p->c_lflag |= _ECHONL;
if (buf.c_lflag & _SYSV_NOFLSH)
termios_p->c_lflag |= _NOFLSH;
if (buf.c_lflag & _SYSV_TOSTOP)
termios_p->c_lflag |= _TOSTOP;
if (buf.c_lflag & _SYSV_ECHOKE)
termios_p->c_lflag |= ECHOKE;
if (buf.c_lflag & _SYSV_ECHOPRT)
termios_p->c_lflag |= ECHOPRT;
if (buf.c_lflag & _SYSV_ECHOCTL)
termios_p->c_lflag |= ECHOCTL;
if (buf.c_lflag & _SYSV_FLUSHO)
termios_p->c_lflag |= FLUSHO;
if (buf.c_lflag & _SYSV_PENDIN)
termios_p->c_lflag |= PENDIN;
if (buf.c_lflag & _SYSV_IEXTEN)
termios_p->c_lflag |= IEXTEN;
termios_p->c_cc[VEOF] = buf.c_cc[_SYSV_VEOF];
termios_p->c_cc[VEOL] = buf.c_cc[_SYSV_VEOL];
termios_p->c_cc[VEOL2] = buf.c_cc[_SYSV_VEOL2];
termios_p->c_cc[VERASE] = buf.c_cc[_SYSV_VERASE];
termios_p->c_cc[VKILL] = buf.c_cc[_SYSV_VKILL];
termios_p->c_cc[VINTR] = buf.c_cc[_SYSV_VINTR];
termios_p->c_cc[VQUIT] = buf.c_cc[_SYSV_VQUIT];
termios_p->c_cc[VSTART] = '\021'; /* XON (^Q). */
termios_p->c_cc[VSTOP] = '\023'; /* XOFF (^S). */
termios_p->c_cc[VSUSP] = '\0'; /* System V release 3 lacks job control. */
termios_p->c_cc[VMIN] = buf.c_cc[_SYSV_VMIN];
termios_p->c_cc[VTIME] = buf.c_cc[_SYSV_VTIME];
return 0;
}
weak_alias (__tcgetattr, tcgetattr)

View File

@ -1,35 +0,0 @@
/* Copyright (C) 1992, 1997, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <termios.h>
#include <sysv_termio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ioctl.h>
/* Return the foreground process group ID of FD. */
pid_t
tcgetpgrp (fd)
int fd;
{
int pgrp;
if (__ioctl (fd, _TIOCGPGRP, &pgrp) < 0)
return (pid_t) -1;
return (pid_t) pgrp;
}
libc_hidden_def (tcgetpgrp)

View File

@ -1,43 +0,0 @@
/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <errno.h>
#include <stddef.h>
#include <signal.h>
#include <termios.h>
#include <unistd.h>
#include <sysv_termio.h>
#include <sys/ioctl.h>
/* Send zero bits on FD. */
int
tcsendbreak (fd, duration)
int fd;
int duration;
{
/* The break lasts 0.25 to 0.5 seconds if DURATION is zero,
and an implementation-defined period if DURATION is nonzero.
We define a positive DURATION to be number of milliseconds to break. */
if (duration <= 0)
return __ioctl (fd, _TCSBRK, 0);
/* ioctl can't send a break of any other duration for us.
This could be changed to use trickery (e.g. lower speed and
send a '\0') to send the break, but for now just return an error. */
__set_errno (EINVAL);
return -1;
}

View File

@ -1,209 +0,0 @@
/* Copyright (C) 1992, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <errno.h>
#include <stddef.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <sysv_termio.h>
const speed_t __unix_speeds[] =
{
0,
50,
75,
110,
134,
150,
200,
300,
600,
1200,
1800,
2400,
4800,
9600,
19200,
38400,
};
/* Set the state of FD to *TERMIOS_P. */
int
tcsetattr (fd, optional_actions, termios_p)
int fd;
int optional_actions;
const struct termios *termios_p;
{
struct __sysv_termio buf;
int ioctl_function;
size_t i;
if (termios_p == NULL)
{
__set_errno (EINVAL);
return -1;
}
switch (optional_actions)
{
case TCSANOW:
ioctl_function = _TCSETA;
break;
case TCSADRAIN:
ioctl_function = _TCSETAW;
break;
case TCSAFLUSH:
ioctl_function = _TCSETAF;
break;
default:
__set_errno (EINVAL);
return -1;
}
if (termios_p->__ispeed != termios_p->__ospeed)
{
__set_errno (EINVAL);
return -1;
}
buf.c_cflag = -1;
for (i = 0; i <= sizeof (__unix_speeds) / sizeof (__unix_speeds[0]); ++i)
{
if (__unix_speeds[i] == termios_p->__ispeed)
buf.c_cflag = i;
}
if (buf.c_cflag == -1)
{
__set_errno (EINVAL);
return -1;
}
buf.c_iflag = 0;
if (termios_p->c_iflag & IGNBRK)
buf.c_iflag |= _SYSV_IGNBRK;
if (termios_p->c_iflag & BRKINT)
buf.c_iflag |= _SYSV_BRKINT;
if (termios_p->c_iflag & IGNPAR)
buf.c_iflag |= _SYSV_IGNPAR;
if (termios_p->c_iflag & PARMRK)
buf.c_iflag |= _SYSV_PARMRK;
if (termios_p->c_iflag & INPCK)
buf.c_iflag |= _SYSV_INPCK;
if (termios_p->c_iflag & ISTRIP)
buf.c_iflag |= _SYSV_ISTRIP;
if (termios_p->c_iflag & INLCR)
buf.c_iflag |= _SYSV_INLCR;
if (termios_p->c_iflag & IGNCR)
buf.c_iflag |= _SYSV_IGNCR;
if (termios_p->c_iflag & ICRNL)
buf.c_iflag |= _SYSV_ICRNL;
if (termios_p->c_iflag & IXON)
buf.c_iflag |= _SYSV_IXON;
if (termios_p->c_iflag & IXOFF)
buf.c_iflag |= _SYSV_IXOFF;
if (termios_p->c_iflag & IXANY)
buf.c_iflag |= _SYSV_IXANY;
if (termios_p->c_iflag & IMAXBEL)
buf.c_iflag |= _SYSV_IMAXBEL;
buf.c_oflag = 0;
if (termios_p->c_oflag & OPOST)
buf.c_oflag |= _SYSV_OPOST;
if (termios_p->c_oflag & ONLCR)
buf.c_oflag |= _SYSV_ONLCR;
/* So far, buf.c_cflag contains the speed in CBAUD. */
if (termios_p->c_cflag & CSTOPB)
buf.c_cflag |= _SYSV_CSTOPB;
if (termios_p->c_cflag & CREAD)
buf.c_cflag |= _SYSV_CREAD;
if (termios_p->c_cflag & PARENB)
buf.c_cflag |= _SYSV_PARENB;
if (termios_p->c_cflag & PARODD)
buf.c_cflag |= _SYSV_PARODD;
if (termios_p->c_cflag & HUPCL)
buf.c_cflag |= _SYSV_HUPCL;
if (termios_p->c_cflag & CLOCAL)
buf.c_cflag |= _SYSV_CLOCAL;
switch (termios_p->c_cflag & CSIZE)
{
case CS5:
buf.c_cflag |= _SYSV_CS5;
break;
case CS6:
buf.c_cflag |= _SYSV_CS6;
break;
case CS7:
buf.c_cflag |= _SYSV_CS7;
break;
case CS8:
buf.c_cflag |= _SYSV_CS8;
break;
}
buf.c_lflag = 0;
if (termios_p->c_lflag & ISIG)
buf.c_lflag |= _SYSV_ISIG;
if (termios_p->c_lflag & ICANON)
buf.c_lflag |= _SYSV_ICANON;
if (termios_p->c_lflag & ECHO)
buf.c_lflag |= _SYSV_ECHO;
if (termios_p->c_lflag & ECHOE)
buf.c_lflag |= _SYSV_ECHOE;
if (termios_p->c_lflag & ECHOK)
buf.c_lflag |= _SYSV_ECHOK;
if (termios_p->c_lflag & ECHONL)
buf.c_lflag |= _SYSV_ECHONL;
if (termios_p->c_lflag & NOFLSH)
buf.c_lflag |= _SYSV_NOFLSH;
if (termios_p->c_lflag & TOSTOP)
buf.c_lflag |= _SYSV_TOSTOP;
if (termios_p->c_lflag & ECHOCTL)
buf.c_lflag |= _SYSV_ECHOCTL;
if (termios_p->c_lflag & ECHOPRT)
buf.c_lflag |= _SYSV_ECHOPRT;
if (termios_p->c_lflag & ECHOKE)
buf.c_lflag |= _SYSV_ECHOKE;
if (termios_p->c_lflag & FLUSHO)
buf.c_lflag |= _SYSV_FLUSHO;
if (termios_p->c_lflag & PENDIN)
buf.c_lflag |= _SYSV_PENDIN;
if (termios_p->c_lflag & IEXTEN)
buf.c_lflag |= _SYSV_IEXTEN;
buf.c_cc[_SYSV_VINTR] = termios_p->c_cc[VINTR];
buf.c_cc[_SYSV_VQUIT] = termios_p->c_cc[VQUIT];
buf.c_cc[_SYSV_VERASE] = termios_p->c_cc[VERASE];
buf.c_cc[_SYSV_VKILL] = termios_p->c_cc[VKILL];
if (buf.c_lflag & _SYSV_ICANON)
{
buf.c_cc[_SYSV_VEOF] = termios_p->c_cc[VEOF];
buf.c_cc[_SYSV_VEOL] = termios_p->c_cc[VEOL];
}
else
{
buf.c_cc[_SYSV_VMIN] = termios_p->c_cc[VMIN];
buf.c_cc[_SYSV_VTIME] = termios_p->c_cc[VTIME];
}
buf.c_cc[_SYSV_VEOL2] = termios_p->c_cc[VEOL2];
if (__ioctl (fd, ioctl_function, &buf) < 0)
return -1;
return 0;
}
libc_hidden_def (tcsetattr)

View File

@ -1,31 +0,0 @@
/* Copyright (C) 1992, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <sys/types.h>
#include <sysv_termio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/ioctl.h>
/* Set the foreground process group ID of FD set PGRP_ID. */
int
tcsetpgrp (fd, pgrp_id)
int fd;
pid_t pgrp_id;
{
return __ioctl (fd, _TIOCSPGRP, &pgrp_id);
}