aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-01-30 11:44:34 +0000
committerUlrich Drepper <drepper@redhat.com>1998-01-30 11:44:34 +0000
commit6591c3356242ba48627beb29345e4e44242c7068 (patch)
tree402220c75072909733e8d383ea5b999f30f1f527 /sysdeps/unix/sysv
parent7f0ff1b04ad67b1a4f624a8ad54e7533d1c8aab3 (diff)
downloadglibc-6591c3356242ba48627beb29345e4e44242c7068.tar
glibc-6591c3356242ba48627beb29345e4e44242c7068.tar.gz
glibc-6591c3356242ba48627beb29345e4e44242c7068.tar.bz2
glibc-6591c3356242ba48627beb29345e4e44242c7068.zip
Update.
1998-01-30 19:58 Ulrich Drepper <drepper@cygnus.com> * include/cpio.h: Move to ... * posix/cpio.h: ...here. * locale/programs/ld-collate.c: Fix typo. * signal/signal.h: Declare _sys_siglist with NSIG+1 elements. * stdio-common/tiformat.c: Add checks for %#.0o and friends. * login/utmp_file.c (pututline_file): Don't always report success if similar entry is found. Patch by Mark M. Kettenis. 1998-01-30 16:06 Philip Blundell <pb@nexus.co.uk> * manual/Makefile: Don't try to install the info files if makeinfo is not available. 1998-01-30 12:05 Philip Blundell <pb@nexus.co.uk> * sysdeps/unix/sysv/linux/bits/ioctls.h: Include a copy of the kernel's network ioctls, rather than using <linux/sockios.h> to get them. This way we are sure of maintaining compatibility if the kernel interface should change. 1998-01-30 15:52 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/Dist: Add netrose/rose.h. 1998-01-25 19:54 Philip Blundell <Philip.Blundell@pobox.com> * sysdeps/unix/sysv/linux/netrose/rose.h: New file. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Install it. 1998-01-27 22:29 Zack Weinberg <zack@rabi.phys.columbia.edu> Implement System V pseudoterminal handling. * login/Makefile (routines): Add getpt, grantpt, unlockpt, ptsname. (libutil-routines): Remove pty. Add openpty, forkpty. (distribute): New internal header pty-internal.h. (others): Add the helper program, pt_chown. (install-others): Install it, in $(libexecdir), mode 4755. * login/pty-internal.h: New file. * login/openpty.c: New file. * login/forkpty.c: New file. * login/programs/pt_chown.c: New file. * libc.map: Add getpt, grantpt, unlockpt, ptsname, ptsname_r. * stdlib/stdlib.h: Prototype them. * config.make.in: Define $(libexecdir). * Makeconfig: Define $(inst_libexecdir). * sysdeps/generic/pty.c: Removed. * sysdeps/unix/sysv/linux/pty.c: Removed. * sysdeps/generic/getpt.c: Stub out. * sysdeps/generic/grantpt.c: Likewise. * sysdeps/generic/ptsname.c: Likewise. * sysdeps/generic/unlockpt.c: Likewise. * sysdeps/unix/grantpt.c: New file. * sysdeps/unix/bsd/getpt.c: New file. * sysdeps/unix/bsd/unlockpt.c: New file. * sysdeps/unix/sysv/linux/getpt.c: New file. * sysdeps/unix/sysv/linux/ptsname.c: New file. * sysdeps/unix/sysv/linux/unlockpt.c: New file. 1998-01-29 23:56 Ulrich Drepper <drepper@cygnus.com> * localedata/locales/ru_RU: Fix YESEXPR. Patch by lav@yars.free.net. 1998-01-29 Andreas Jaeger <aj@arthur.rhein-neckar.de> * nss/Makefile (tests): Add rule for test-netdb.c. * nss/test-netdb.c: New file. 1998-01-29 02:38 Ulrich Drepper <drepper@cygnus.com> * elf/dl-open.c (_dl_open): Make sure the variable `reloc' is really kept as a variable. Patch by Richard Henderson, reported by Jakub Jelinek <jj@sunsite.ms.mff.cuni.cz>. * elf/rtld.c (dl_main): Call _dl_init_paths before handling preloading. * elf/genrtldtbl.awk: Mark machine dependent directory of generated entries as not existing. 1998-01-26 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * stdio-common/vfprintf.c (process_arg): Fix printing of octal zero in alternate form with precision of zero, which must produce "0". Add braces to avoid ambiguous `else'. 1998-01-26 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * nis/nss_compat/compat-grp.c: Fix memory leak and trailing null problem with strncpy. * nis/nss_compat/compat-pwd.c: Likewise. * nis/nss_compat/comapt-spwd.c: Likewise. 1998-01-28 Andreas Jaeger <aj@arthur.rhein-neckar.de> * assert/assert.h (assert_perror): Correct test for errnum. Patch by uch@nop.or.jp. [PR libc/437] 1997-12-20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * locales/pl_PL: Fix int_curr_symbol. 1998-01-26 Andreas Jaeger <aj@arthur.rhein-neckar.de> * nis/nis_cache.c: Include <unistd.h> for declaration of close. 1998-01-06 Andreas Jaeger <aj@arthur.rhein-neckar.de> * stdio-common/test-popen.c: Include <errno.h>. * sysdeps/unix/sysv/linux/if_index.c: Include <unistd.h> for close. * inet/getnetgrent_r.c: Include <errno.h>. * db2/db/db_conv.c: Include <string.h> for memcpy. * gmon/bb_exit_func.c: Include <string.h> instead of <strings.h> so that memcpy is declared. * iconv/iconv_open.c: Include <stdlib.h> for alloca. * misc/init-misc.c: Remove unneeded inclusion of <errno.h>. 1998-01-26 Andreas Jaeger <aj@arthur.rhein-neckar.de> * pwd/fgetpwent_r.c (__fgetpwent_r): Correctly handle buffer overflow while reading line with fgets. * grp/fgetgrent_r.c (__fgetgrent_r): Likewise. 1998-01-27 00:46 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/bits/types.h (__ipc_pid_t): Change to unsigned short, not short. Reported by Andreas Jaeger. 1998-01-06 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/unix/sysv/linux/mips/syscalls.list: Correct typo (ccept->accept). * sysdeps/generic/inttypes.h: Fix spelling. 1998-01-04 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/unix/sysv/linux/arm/Dist: Add bits/mman.h. * sysdeps/unix/sysv/linux/alpha/Dist: Add net/route.h. 1998-01-27 00:30 Ulrich Drepper <drepper@cygnus.com> * stdio-common/printf.h (struct print_info): Add new bitfield is_char. * stdio-common/printf-parse.h (parse_one_spec): Fill in is_char field for hh modifier. * stdio-common/vfprint.c: Use is_char field and do not depend in is_short having the value 2. Bug reported by Andreas Jaeger. 1998-01-05 Andreas Jaeger <aj@arthur.rhein-neckar.de> * libio/freopen.c (freopen): Call _IO_old_freopen only if defined PIC && DO_VERSIONING. 1998-01-24 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * Rules: Add rules for $(common-objpfx)dummy$o.
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r--sysdeps/unix/sysv/linux/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/Makefile3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/arm/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/bits/ioctls.h87
-rw-r--r--sysdeps/unix/sysv/linux/bits/types.h2
-rw-r--r--sysdeps/unix/sysv/linux/getpt.c76
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c3
-rw-r--r--sysdeps/unix/sysv/linux/mips/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/netrose/rose.h (renamed from sysdeps/unix/sysv/linux/m68k/sigreturn.S)16
-rw-r--r--sysdeps/unix/sysv/linux/ptsname.c108
-rw-r--r--sysdeps/unix/sysv/linux/pty.c3
-rw-r--r--sysdeps/unix/sysv/linux/siglist.c18
-rw-r--r--sysdeps/unix/sysv/linux/unlockpt.c50
14 files changed, 352 insertions, 19 deletions
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist
index 6743794281..c1b6ec91c2 100644
--- a/sysdeps/unix/sysv/linux/Dist
+++ b/sysdeps/unix/sysv/linux/Dist
@@ -33,6 +33,7 @@ netinet/tcp.h
netinet/udp.h
netipx/ipx.h
netrom/netrom.h
+netrose/rose.h
nfs/nfs.h
rt_sigaction.c
rt_sigpending.c
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 29f1566753..a71ee439a0 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -79,7 +79,8 @@ ifeq ($(subdir),inet)
sysdep_headers += netinet/in_systm.h netinet/udp.h \
netinet/if_fddi.h netinet/if_tr.h netinet/igmp.h \
netinet/ip_fw.h netinet/ip_icmp.h netipx/ipx.h \
- sys/socketvar.h netax25/ax25.h netrom/netrom.h
+ sys/socketvar.h netax25/ax25.h netrom/netrom.h \
+ netrose/rose.h
endif
ifeq ($(subdir),posix)
diff --git a/sysdeps/unix/sysv/linux/alpha/Dist b/sysdeps/unix/sysv/linux/alpha/Dist
index 715fda7bd3..5b5dca44da 100644
--- a/sysdeps/unix/sysv/linux/alpha/Dist
+++ b/sysdeps/unix/sysv/linux/alpha/Dist
@@ -9,6 +9,7 @@ ioperm.c
kernel_sigaction.h
kernel_stat.h
kernel_termios.h
+net/route.h
sys/acct.h
sys/io.h
sys/procfs.h
diff --git a/sysdeps/unix/sysv/linux/arm/Dist b/sysdeps/unix/sysv/linux/arm/Dist
index 738b9cc542..d987285445 100644
--- a/sysdeps/unix/sysv/linux/arm/Dist
+++ b/sysdeps/unix/sysv/linux/arm/Dist
@@ -1 +1,2 @@
+bits/mman.h
clone.S
diff --git a/sysdeps/unix/sysv/linux/bits/ioctls.h b/sysdeps/unix/sysv/linux/bits/ioctls.h
index a89724cd71..7208d3bd4f 100644
--- a/sysdeps/unix/sysv/linux/bits/ioctls.h
+++ b/sysdeps/unix/sysv/linux/bits/ioctls.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 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
@@ -22,4 +22,87 @@
/* Use the definitions from the kernel header files. */
#include <asm/ioctls.h>
-#include <linux/sockios.h>
+
+/* Routing table calls. */
+#define SIOCADDRT 0x890B /* add routing table entry */
+#define SIOCDELRT 0x890C /* delete routing table entry */
+#define SIOCRTMSG 0x890D /* call to routing system */
+
+/* Socket configuration controls. */
+#define SIOCGIFNAME 0x8910 /* get iface name */
+#define SIOCSIFLINK 0x8911 /* set iface channel */
+#define SIOCGIFCONF 0x8912 /* get iface list */
+#define SIOCGIFFLAGS 0x8913 /* get flags */
+#define SIOCSIFFLAGS 0x8914 /* set flags */
+#define SIOCGIFADDR 0x8915 /* get PA address */
+#define SIOCSIFADDR 0x8916 /* set PA address */
+#define SIOCGIFDSTADDR 0x8917 /* get remote PA address */
+#define SIOCSIFDSTADDR 0x8918 /* set remote PA address */
+#define SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */
+#define SIOCSIFBRDADDR 0x891a /* set broadcast PA address */
+#define SIOCGIFNETMASK 0x891b /* get network PA mask */
+#define SIOCSIFNETMASK 0x891c /* set network PA mask */
+#define SIOCGIFMETRIC 0x891d /* get metric */
+#define SIOCSIFMETRIC 0x891e /* set metric */
+#define SIOCGIFMEM 0x891f /* get memory address (BSD) */
+#define SIOCSIFMEM 0x8920 /* set memory address (BSD) */
+#define SIOCGIFMTU 0x8921 /* get MTU size */
+#define SIOCSIFMTU 0x8922 /* set MTU size */
+#define SIOCSIFHWADDR 0x8924 /* set hardware address */
+#define SIOCGIFENCAP 0x8925 /* get/set encapsulations */
+#define SIOCSIFENCAP 0x8926
+#define SIOCGIFHWADDR 0x8927 /* Get hardware address */
+#define SIOCGIFSLAVE 0x8929 /* Driver slaving support */
+#define SIOCSIFSLAVE 0x8930
+#define SIOCADDMULTI 0x8931 /* Multicast address lists */
+#define SIOCDELMULTI 0x8932
+#define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */
+#define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */
+#define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */
+#define SIOCGIFPFLAGS 0x8935
+#define SIOCDIFADDR 0x8936 /* delete PA address */
+#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */
+#define SIOCGIFCOUNT 0x8938 /* get number of devices */
+
+#define SIOCGIFBR 0x8940 /* Bridging support */
+#define SIOCSIFBR 0x8941 /* Set bridging options */
+
+#define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
+#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
+
+
+/* ARP cache control calls. */
+ /* 0x8950 - 0x8952 * obsolete calls, don't re-use */
+#define SIOCDARP 0x8953 /* delete ARP table entry */
+#define SIOCGARP 0x8954 /* get ARP table entry */
+#define SIOCSARP 0x8955 /* set ARP table entry */
+
+/* RARP cache control calls. */
+#define SIOCDRARP 0x8960 /* delete RARP table entry */
+#define SIOCGRARP 0x8961 /* get RARP table entry */
+#define SIOCSRARP 0x8962 /* set RARP table entry */
+
+/* Driver configuration calls */
+
+#define SIOCGIFMAP 0x8970 /* Get device parameters */
+#define SIOCSIFMAP 0x8971 /* Set device parameters */
+
+/* DLCI configuration calls */
+
+#define SIOCADDDLCI 0x8980 /* Create new DLCI device */
+#define SIOCDELDLCI 0x8981 /* Delete DLCI device */
+
+/* Device private ioctl calls. */
+
+/* These 16 ioctls are available to devices via the do_ioctl() device
+ vector. Each device should include this file and redefine these
+ names as their own. Because these are device dependent it is a good
+ idea _NOT_ to issue them to random objects and hope. */
+
+#define SIOCDEVPRIVATE 0x89F0 /* to 89FF */
+
+/*
+ * These 16 ioctl calls are protocol private
+ */
+
+#define SIOCPROTOPRIVATE 0x89E0 /* to 89EF */
diff --git a/sysdeps/unix/sysv/linux/bits/types.h b/sysdeps/unix/sysv/linux/bits/types.h
index 68cbf8ca7d..16111beed0 100644
--- a/sysdeps/unix/sysv/linux/bits/types.h
+++ b/sysdeps/unix/sysv/linux/bits/types.h
@@ -104,7 +104,7 @@ typedef struct
typedef int __key_t;
/* Used in `struct shmid_ds'. */
-typedef short int __ipc_pid_t;
+typedef unsigned short int __ipc_pid_t;
/* Types from the Large File Support interface. */
diff --git a/sysdeps/unix/sysv/linux/getpt.c b/sysdeps/unix/sysv/linux/getpt.c
new file mode 100644
index 0000000000..8eea2ffa82
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getpt.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sys/types.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#include "pty-internal.h"
+
+/* Per Documentation/devices.txt: pty masters are /dev/pty[p-za-e][0-9a-f].
+ These strings are used also in ptsname.c. */
+const char __ptyname1[] = "pqrstuvwxyzabcde";
+const char __ptyname2[] = "0123456789abcdef";
+
+/* Open the master side of a pseudoterminal and return its file
+ descriptor, or -1 on error. Linux version. */
+int
+__getpt ()
+{
+ int fd;
+ const char *i, *j;
+ static int have_dev_ptmx = 1;
+ char namebuf[PTYNAMELEN];
+
+ /* The new way: */
+ if (have_dev_ptmx)
+ {
+ fd = open ("/dev/ptmx", O_RDWR);
+ if (fd != -1)
+ return fd;
+ else
+ {
+ if (errno == ENOENT || errno == ENODEV)
+ have_dev_ptmx = 0;
+ else
+ return -1;
+ }
+ }
+
+ /* The old way: */
+ strcpy (namebuf, "/dev/pty");
+ namebuf[10] = '\0';
+ for (i = __ptyname1; *i; ++i)
+ {
+ namebuf[8] = *i;
+ for (j = __ptyname2; *j; ++j)
+ {
+ namebuf[9] = *j;
+ fd = open (namebuf, O_RDWR);
+ if (fd != -1)
+ return fd;
+ if (errno != EIO)
+ return -1;
+ }
+ }
+ __set_errno (ENFILE);
+ return -1;
+}
+weak_alias (__getpt, getpt)
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 2e0bc5bf8f..9d9bf0e0b2 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 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
@@ -20,6 +20,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
#include <net/if.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index 1c9c095ed3..d026910ee2 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -16,7 +16,7 @@ sigsuspend - sigsuspend 1 __sigsuspend sigsuspend
# Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
# it's provided for compatibility, though.
#
-ccept - accept 3 __libc_accept __accept accept
+accept - accept 3 __libc_accept __accept accept
bind - bind 3 __bind bind
connect - connect 3 __libc_connect __connect connect
getpeername - getpeername 3 __getpeername getpeername
diff --git a/sysdeps/unix/sysv/linux/m68k/sigreturn.S b/sysdeps/unix/sysv/linux/netrose/rose.h
index 34c0a91952..c158c66bb7 100644
--- a/sysdeps/unix/sysv/linux/m68k/sigreturn.S
+++ b/sysdeps/unix/sysv/linux/netrose/rose.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Definitions for Rose packet radio address family.
+ Copyright (C) 1998 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
@@ -16,14 +17,9 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <sysdep.h>
+#ifndef _NETROSE_ROSE_H
+#define _NETROSE_ROSE_H 1
-.text
-ENTRY (__sigreturn)
- addq.l #4, %sp /* Pop the return PC. */
- DO_CALL (#SYS_ify (sigreturn), 0)
- /* Do the system call; it never returns. */
- /* NOTREACHED */
-END (__sigreturn)
+#include <linux/rose.h> /* Ask, and the kernel will provide. */
-weak_alias (__sigreturn, sigreturn)
+#endif
diff --git a/sysdeps/unix/sysv/linux/ptsname.c b/sysdeps/unix/sysv/linux/ptsname.c
new file mode 100644
index 0000000000..04feadd436
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ptsname.c
@@ -0,0 +1,108 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <termios.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#include "pty-internal.h"
+
+#include <stdio-common/_itoa.h>
+#include <sys/sysmacros.h>
+
+/* Given the file descriptor of a master pty, return the pathname
+ of the associated slave. */
+
+static char namebuf[PTYNAMELEN];
+extern const char __ptyname1[], __ptyname2[]; /* defined in getpt.c */
+
+char *
+ptsname (fd)
+ int fd;
+{
+ return __ptsname_r (fd, namebuf, PTYNAMELEN);
+}
+
+char *
+__ptsname_r (fd, buf, len)
+ int fd;
+ char *buf;
+ unsigned int len;
+{
+ char nbuf[PTYNAMELEN], idbuf[6];
+ int ptyno;
+ struct stat st;
+
+#ifdef TIOCGPTN
+ static int tiocgptn_works = 1;
+ if (tiocgptn_works)
+ {
+ if (!ioctl (fd, TIOCGPTN, &ptyno))
+ goto gotit;
+ else
+ {
+ if(errno != EINVAL)
+ return 0;
+ else
+ tiocgptn_works = 0;
+ }
+ }
+#endif
+ /* /dev/ptmx will make it into the kernel before 32 bit dev_t, so
+ this should be safe. */
+ if (fstat (fd, &st))
+ return 0;
+
+ ptyno = minor (st.st_rdev);
+
+#ifdef TIOCGPTN
+gotit:
+#endif
+ /* Two different possible naming schemes for pty slaves:
+ the SVr4 way. */
+
+ idbuf[5] = '\0';
+ stpcpy (stpcpy (nbuf, "/dev/pts/"),
+ _itoa_word (ptyno, &idbuf[4], 10, 0));
+ if (!stat (nbuf, &st))
+ {
+ strncpy (buf, nbuf, len);
+ return buf;
+ }
+ else
+ if (errno != ENOENT)
+ return NULL;
+
+ /* ...and the BSD way. */
+ nbuf[7] = 'y';
+ nbuf[8] = __ptyname1[ptyno / 16];
+ nbuf[9] = __ptyname2[ptyno % 16];
+ nbuf[10] = '\0';
+
+ if (stat (nbuf, &st))
+ return NULL;
+
+ strncpy (buf, nbuf, len);
+ return buf;
+}
+weak_alias (__ptsname_r, ptsname_r)
diff --git a/sysdeps/unix/sysv/linux/pty.c b/sysdeps/unix/sysv/linux/pty.c
deleted file mode 100644
index e64261c8c4..0000000000
--- a/sysdeps/unix/sysv/linux/pty.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Linux does not has the `revoke' function. */
-#define REVOKE(Line)
-#include <sysdeps/generic/pty.c>
diff --git a/sysdeps/unix/sysv/linux/siglist.c b/sysdeps/unix/sysv/linux/siglist.c
index 43b229fc95..ae5ca6b8ec 100644
--- a/sysdeps/unix/sysv/linux/siglist.c
+++ b/sysdeps/unix/sysv/linux/siglist.c
@@ -1,3 +1,21 @@
+/* Copyright (C) 1997, 1998 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
#include <stddef.h>
#include <signal.h>
diff --git a/sysdeps/unix/sysv/linux/unlockpt.c b/sysdeps/unix/sysv/linux/unlockpt.c
new file mode 100644
index 0000000000..e508b280c5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/unlockpt.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sys/ioctl.h>
+#include <termios.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* Given a fd on a master pseudoterminal, clear a kernel lock so that
+ the slave can be opened. This is to avoid a race between opening the
+ master and calling grantpt() to take possession of the slave. */
+int
+unlockpt (fd)
+ int fd __attribute__ ((unused));
+{
+#ifdef TIOCSPTLCK
+ int serrno = errno;
+ int unlock = 0;
+
+ if (ioctl (fd, TIOCSPTLCK, &unlock))
+ {
+ if(errno == EINVAL)
+ {
+ __set_errno (serrno);
+ return 0;
+ }
+ else
+ return -1;
+ }
+#else
+ /* On pre-/dev/ptmx kernels this function should be a no-op. */
+ return 0;
+#endif
+}