about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-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
+}