mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-30 14:31:14 +00:00
df9629171c
* sysdeps/generic/seteuid.c (seteuid): Add libc_hidden_def. * sysdeps/generic/setegid.c (setegid): Likewise. * sysdeps/mach/hurd/seteuid.c (seteuid): Likewise. * sysdeps/mach/hurd/setegid.c (setegid): Likewise. * sysdeps/unix/bsd/seteuid.c (seteuid): Likewise. * sysdeps/unix/bsd/setegid.c (setegid): Likewise. * sysdeps/unix/sysv/aix/seteuid.c (seteuid): Likewise. * sysdeps/unix/sysv/aix/setegid.c (setegid): Likewise. * sysdeps/unix/sysv/linux/i386/setegid.c (setegid): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c (seteuid): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c (setegid): Likewise. * sysdeps/unix/sysv/linux/seteuid.c (seteuid): Likewise. * sysdeps/unix/sysv/linux/setegid.c (setegid): Likewise. * sysdeps/unix/sysv/linux/i386/seteuid.c (seteuid): Likewise. Remove fallback if __ASSUME_SETRESUID_SYSCALL. * include/sys/stat.h (__fxstat_internal, __fxstat64_internal, __lxstat_internal, __lxstat64_internal): Remove. (__fxstat, __fxstat64, __lxstat, __lxstat64, __xstat, __xstat64): Add hidden_proto. * sysdeps/generic/fxstat.c (__fxstat): Add hidden_def. Remove INTDEF where present, remove #undef at the beginning. * sysdeps/generic/fxstat64.c (__fxstat64): Likewise. * sysdeps/generic/lxstat.c (__lxstat): Likewise. * sysdeps/generic/lxstat64.c (__lxstat64): Likewise. * sysdeps/generic/xstat.c (__xstat): Likewise. * sysdeps/generic/xstat64.c (__xstat64): Likewise. * sysdeps/mach/hurd/dl-sysdep.c (__xstat64, __fxstat64): Likewise. * sysdeps/mach/hurd/fxstat.c (__fxstat): Likewise. * sysdeps/mach/hurd/fxstat64.c (__fxstat64): Likewise. * sysdeps/mach/hurd/lxstat.c (__lxstat): Likewise. * sysdeps/mach/hurd/lxstat64.c (__lxstat64): Likewise. * sysdeps/mach/hurd/xstat.c (__xstat): Likewise. * sysdeps/mach/hurd/xstat64.c (__xstat64): Likewise. * sysdeps/unix/fxstat.c (__fxstat): Likewise. * sysdeps/unix/common/lxstat.c (__lxstat): Likewise. * sysdeps/unix/sysv/aix/fxstat.c (__fxstat): Likewise. * sysdeps/unix/sysv/aix/fxstat64.c (__fxstat64): Likewise. * sysdeps/unix/sysv/aix/lxstat.c (__lxstat): Likewise. * sysdeps/unix/sysv/aix/lxstat64.c (__lxstat64): Likewise. * sysdeps/unix/sysv/aix/xstat.c (__xstat): Likewise. * sysdeps/unix/sysv/aix/xstat64.c (__xstat64): Likewise. * sysdeps/unix/sysv/linux/ia64/fxstat.c (__fxstat): Likewise. * sysdeps/unix/sysv/linux/ia64/lxstat.c (__lxstat): Likewise. * sysdeps/unix/sysv/linux/ia64/xstat.c (__xstat): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/fxstat.c (__fxstat): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/lxstat.c (__lxstat): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/xstat.c (__xstat): Likewise. * sysdeps/unix/sysv/linux/i386/fxstat.c (__fxstat): Likewise. * sysdeps/unix/sysv/linux/i386/lxstat.c (__lxstat): Likewise. * sysdeps/unix/sysv/linux/i386/xstat.c (__xstat): Likewise. * sysdeps/unix/sysv/linux/xstat.c (__xstat): Likewise. * sysdeps/unix/sysv/linux/xstat64.c (__xstat64): Likewise. * sysdeps/unix/sysv/linux/fxstat.c (__fxstat): Likewise. * sysdeps/unix/sysv/linux/fxstat64.c (__fxstat64): Likewise. * sysdeps/unix/sysv/linux/lxstat.c (__lxstat): Likewise. * sysdeps/unix/sysv/linux/lxstat64.c (__lxstat64): Likewise. * sysdeps/unix/xstat.c (__xstat): Likewise. * include/sys/statvfs.h (statvfs, fstatvfs): Add libc_hidden_proto. * sysdeps/generic/statvfs.c (statvfs): Add libc_hidden_def. * sysdeps/generic/fstatvfs.c (fstatvfs): Likewise. * sysdeps/mach/hurd/statvfs.c (statvfs): Likewise. * sysdeps/mach/hurd/fstatvfs.c (fstatvfs): Likewise. * sysdeps/unix/sysv/linux/statvfs.c (statvfs): Likewise. * sysdeps/unix/sysv/linux/fstatvfs.c (fstatvfs): Likewise. * include/unistd.h (tcgetpgrp): Add libc_hidden_proto. * include/termios.h (tcsetattr, cfsetispeed, cfsetospeed): Likewise. * sysdeps/generic/tcgetpgrp.c (tcgetpgrp): Add libc_hidden_def. * sysdeps/generic/tcsetattr.c (tcsetattr): Likewise. * sysdeps/generic/speed.c (cfsetispeed, cfsetospeed): Likewise. * sysdeps/unix/bsd/bsd4.4/tcsetattr.c (tcgetpgrp): Likewise. * sysdeps/unix/bsd/sun/sunos4/tcsetattr.c (tcsetattr): Likewise. * sysdeps/unix/bsd/sun/sunos4/speed.c (cfsetispeed, cfsetospeed): Likewise. * sysdeps/unix/bsd/tcgetpgrp.c (tcgetpgrp): Likewise. * sysdeps/unix/bsd/tcsetattr.c (tcsetattr): Likewise. * sysdeps/unix/sysv/aix/tcsetattr.c (tcsetattr): Likewise. * sysdeps/unix/sysv/aix/speed.c (cfsetispeed, cfsetospeed): Likewise. * sysdeps/unix/sysv/linux/tcsetattr.c (tcsetattr): Likewise. * sysdeps/unix/sysv/linux/speed.c (cfsetispeed, cfsetospeed): Likewise. * sysdeps/unix/sysv/tcgetpgrp.c (tcgetpgrp): Likewise. * sysdeps/unix/sysv/tcsetattr.c (tcsetattr): Likewise. * include/string.h (strcoll): Add libc_hidden_proto. * string/strcoll.c (strcoll): Add libc_hidden_def. * misc/err.c (vwarn): Fix pasto in libc_hidden_def.
211 lines
5.4 KiB
C
211 lines
5.4 KiB
C
/* 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, write to the Free
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
02111-1307 USA. */
|
|
|
|
#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)
|