about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-09-17 20:23:15 +0000
committerRoland McGrath <roland@gnu.org>1995-09-17 20:23:15 +0000
commit60478656fad8d8a487e9bc52d025f69767c3262b (patch)
tree0ae0836023f1c2f80064e7611f91d19c482208d9 /sysdeps
parent9fd18b6c1b397e1af82a0b544f10f946c73864b6 (diff)
downloadglibc-60478656fad8d8a487e9bc52d025f69767c3262b.tar.gz
glibc-60478656fad8d8a487e9bc52d025f69767c3262b.tar.xz
glibc-60478656fad8d8a487e9bc52d025f69767c3262b.zip
Sat Sep 16 17:47:19 1995 Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>
	* elf/elf.h (AT_GID): Fix typo: Read -> Real.

	* misc/efgvt_r.c: New file.  Reentrant version of [efg]cvt functions.
	* misc/efgcvt.c: Rewrite to use reentrant functions.
	* misc/hsearch_r.c: New file.  Reentrant version of functions from
	hsearch family.
	* misc/hsearch.c, misc/tsearch.c: New files.
	* misc/Makefile (routines): Add efgcvt_r, hsearch_r, hsearch, tsearch.

	* posix/unistd.h (ttyname_r): Add prototype for new function.

	* stdlib/drand48_r.c, stdlib/erand48_r.c, stdlib/jrand48_r.c,
	stdlib/lrand48_r.c, stdlib/mrand48_r.c, stdlib/nrand48_r.c,
	stdlib/seed48_r.c, stdlib/srand48_r.c, stdlib/lcong48_r.c,
	stdlib/drand48-iter.c: New files implementing reentrant versions
	of functions from drand48 family.
	* stdlib/seed48.c, stdlib/drand48.c, stdlib/erand48.c,
	stdlib/jrand48.c, stdlib/lrand48.c, stdlib/mrand48.c,
	stdlib/nrand48.c, stdlib/srand48.c, stdlib/lcong48.c:
	Rewrite to use reentrant versions.
	* stdlib/a64l.c, stdlib/l64a.c: New files.  Implement a64l()
	and l64a() functions from SysV library.
	* stdlib/Makefile (routines): Add drand48_r, erand48_r, lrand48_r,
	nrand48_r, mrand48_r, jrand48_r, srand48_r, seed48_r, lcong48_r,
	drand48-iter, a64l, l64a.
	* stdlib/stdlib.h: Declare them.

	* stdlib/random_r.c: New file.  Reentrant version of functions
	from random family.
	* stdlib/stdlib.h: Declare them.
	* stdlib/random.c: Rewrite to use reentrant functions.

	* string/strerror_r.c: New file.  Reentrant version.
	* string/strerror.c: Change for new _strerror_internal form.
	* string/Makefile (routines): Add strerror_r.

	* sysdeps/generic/dl-sysdep.c (_dl_sysdep_start): Set default
	value of user_entry to `_start'.
	Close AT_ENTRY case with `break'.

	* sysdeps/generic/strstr.c: New and much faster implementation
	by Stephen R. van den Berg.

	* sysdeps/generic/_strerror.c: _strerror_internal now takes
	three argument and has and explicit buffer length.
	* sysdeps/mach/_strerror.c: Change for new interface with three
	arguments.
	* stdio/perror.c, stdio/vfprintf.c: Callers changed.
	
	* sysdeps/mach/hurd/ttyname_r.c: New file.  Reentrant version.
	* sysdeps/posix/ttyname_r.c: New file.  Reentrant version.
	* sysdeps/stub/ttyname_r: New file.  Define as dummy function.

	* sysdeps/posix/utimes.c: Include <utime.h> for prototype.
	(utimes): First parameter to utime must be file, not path.

	* sysdeps/posix/sysconf.c (__sysconf): Test for CLK_TCK in case
	_SC_CLK_TCK and return it when available.
	Test for STREAM_MAX in case _SC_STREAM_MAX and return it when
	available.
	Add case for _SC_2_LOCALEDEF which is now available.

	* posix/sys/types.h [__USE_SVID] (key_t): New type.
	* sysvipc/Makefile, sysvipc/ftok.c, sysvipc/sys/ipc.h,
	sysvipc/sys/msg.h, sysvipc/sys/sem.h, sysvipc/sys/shm.h,
	sysdeps/stub/sys/msq_buf.h, sysdeps/stub/sys/sem_buf.h,
	sysdeps/stub/sys/shm_buf.h, sysdeps/stub/sys/ipc_buf.h,
	sysdeps/stub/semctl.c, sysdeps/stub/semget.c, sysdeps/stub/semop.c,
	sysdeps/stub/shmat.c, sysdeps/stub/shmctl.c, sysdeps/stub/shmdt.c,
	sysdeps/stub/shmget.c, sysdeps/stub/msgctl.c, sysdeps/stub/msgget.c,
	sysdeps/stub/msgrcv.c, sysdeps/stub/msgsnd.c: New files.
	Add implementation of System V IPC.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/_strerror.c12
-rw-r--r--sysdeps/generic/dl-sysdep.c3
-rw-r--r--sysdeps/generic/strstr.c119
-rw-r--r--sysdeps/mach/_strerror.c6
-rw-r--r--sysdeps/mach/hurd/ttyname_r.c49
-rw-r--r--sysdeps/posix/sysconf.c15
-rw-r--r--sysdeps/posix/ttyname_r.c91
-rw-r--r--sysdeps/posix/utimes.c3
-rw-r--r--sysdeps/stub/msgctl.c36
-rw-r--r--sysdeps/stub/msgget.c35
-rw-r--r--sysdeps/stub/msgrcv.c41
-rw-r--r--sysdeps/stub/msgsnd.c40
-rw-r--r--sysdeps/stub/semctl.c37
-rw-r--r--sysdeps/stub/semget.c36
-rw-r--r--sysdeps/stub/semop.c35
-rw-r--r--sysdeps/stub/shmat.c37
-rw-r--r--sysdeps/stub/shmctl.c35
-rw-r--r--sysdeps/stub/shmdt.c34
-rw-r--r--sysdeps/stub/shmget.c36
-rw-r--r--sysdeps/stub/sys/ipc_buf.h58
-rw-r--r--sysdeps/stub/sys/msq_buf.h47
-rw-r--r--sysdeps/stub/sys/sem_buf.h52
-rw-r--r--sysdeps/stub/sys/shm_buf.h53
-rw-r--r--sysdeps/stub/ttyname_r.c42
24 files changed, 914 insertions, 38 deletions
diff --git a/sysdeps/generic/_strerror.c b/sysdeps/generic/_strerror.c
index 455c8ff0a7..0d069f84c5 100644
--- a/sysdeps/generic/_strerror.c
+++ b/sysdeps/generic/_strerror.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 19911993 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1995 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,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -27,13 +26,16 @@ Cambridge, MA 02139, USA.  */
 
 /* Return a string describing the errno code in ERRNUM.  */
 char *
-DEFUN(_strerror_internal, (errnum, buf), int errnum AND char buf[1024])
+_strerror_internal (errnum, buf, buflen)
+     int errnum;
+     char *buf;
+     size_t buflen;
 {
   if (errnum < 0 || errnum > _sys_nerr)
     {
       static char fmt[] = "Unknown error %d";
-      size_t len = sprintf (buf, fmt, errnum);
-      if (len < sizeof(fmt) - 2)
+      size_t len = snprintf (buf, buflen, fmt, errnum);
+      if (len < sizeof (fmt) - 2)
 	return NULL;
       buf[len - 1] = '\0';
       return buf;
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index b18ac2b0f7..c1cf37da76 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -26,6 +26,7 @@ Cambridge, MA 02139, USA.  */
 extern int _dl_argc;
 extern char **_dl_argv;
 extern char **_environ;
+extern void _start (void);
 
 Elf32_Addr
 _dl_sysdep_start (void **start_argptr,
@@ -39,6 +40,7 @@ _dl_sysdep_start (void **start_argptr,
   uid_t uid, euid;
   gid_t gid, egid;
 
+  user_entry = (Elf32_Addr) &_start;
   _dl_argc = *(int *) start_argptr;
   _dl_argv = start_argptr + 1;
   _environ = &_dl_argv[_dl_argc + 1];
@@ -57,6 +59,7 @@ _dl_sysdep_start (void **start_argptr,
 	break;
       case AT_ENTRY:
 	user_entry = av->a_un.a_val;
+	break;
       case AT_UID:
 	uid = av->a_un.a_val;
 	break;
diff --git a/sysdeps/generic/strstr.c b/sysdeps/generic/strstr.c
index 06681de931..9c0e8183b5 100644
--- a/sysdeps/generic/strstr.c
+++ b/sysdeps/generic/strstr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1994 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,41 +16,102 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
-#include <stddef.h>
+/*
+ * My personal strstr() implementation that beats most other algorithms.
+ * Until someone tells me otherwise, I assume that this is the
+ * fastest implementation of strstr() in C.
+ * I deliberately chose not to comment it.  You should have at least
+ * as much fun trying to understand it, as I had to write it :-).
+ *
+ * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de	*/
+
 #include <string.h>
+#include <sys/types.h>
+
+typedef unsigned chartype;
 
-/* Return the first ocurrence of NEEDLE in HAYSTACK.  */
 char *
-DEFUN(strstr, (haystack, needle),
-      CONST char *CONST haystack AND
-      CONST char *CONST needle)
+strstr (phaystack, pneedle)
+     const char *phaystack;
+     const char *pneedle;
 {
-  register CONST char *CONST needle_end = strchr(needle, '\0');
-  register CONST char *CONST haystack_end = strchr(haystack, '\0');
-  register CONST size_t needle_len = needle_end - needle;
-  register CONST size_t needle_last = needle_len - 1;
-  register CONST char *begin;
-
-  if (needle_len == 0)
-    return (char *) haystack;	/* ANSI 4.11.5.7, line 25.  */
-  if ((size_t) (haystack_end - haystack) < needle_len)
-    return NULL;
-
-  for (begin = &haystack[needle_last]; begin < haystack_end; ++begin)
-    {
-      register CONST char *n = &needle[needle_last];
-      register CONST char *h = begin;
+  register const unsigned char *haystack, *needle;
+  register chartype b, c;
+
+  haystack = (const unsigned char *) phaystack;
+  needle = (const unsigned char *) pneedle;
 
+  b = *needle;
+  if (b != '\0')
+    {
+      haystack--;				/* possible ANSI violation */
       do
-	if (*h != *n)
-	  goto loop;		/* continue for loop */
-      while (--n >= needle && --h >= haystack);
+	{
+	  c = *++haystack;
+	  if (c == '\0')
+	    goto ret0;
+	}
+      while (c != b);
 
-      return (char *) h;
+      c = *++needle;
+      if (c == '\0')
+	goto foundneedle;
+      ++needle;
+      goto jin;
 
-    loop:;
-    }
+      for (;;)
+        { 
+          register chartype a;
+	  register const unsigned char *rhaystack, *rneedle;
+
+	  do
+	    {
+	      a = *++haystack;
+	      if (a == '\0')
+		goto ret0;
+	      if (a == b)
+		break;
+	      a = *++haystack;
+	      if (a == '\0')
+		goto ret0;
+shloop:	    }
+          while (a != b);
 
-  return NULL;
+jin:	  a = *++haystack;
+	  if (a == '\0')
+	    goto ret0;
+
+	  if (a != c)
+	    goto shloop;
+
+	  rhaystack = haystack-- + 1;
+	  rneedle = needle;
+	  a = *rneedle;
+
+	  if (*rhaystack == a)
+	    do
+	      {
+		if (a == '\0')
+		  goto foundneedle;
+		++rhaystack;
+		a = *++needle;
+		if (*rhaystack != a)
+		  break;
+		if (a == '\0')
+		  goto foundneedle;
+		++rhaystack;
+		a = *++needle;
+	      }
+	    while (*rhaystack == a);
+
+	  needle = rneedle;		   /* took the register-poor aproach */
+
+	  if (a == '\0')
+	    break;
+        }
+    }
+foundneedle:
+  return (char*) haystack;
+ret0:
+  return 0;
 }
diff --git a/sysdeps/mach/_strerror.c b/sysdeps/mach/_strerror.c
index eeebb9e360..f2411122ea 100644
--- a/sysdeps/mach/_strerror.c
+++ b/sysdeps/mach/_strerror.c
@@ -24,7 +24,7 @@ Cambridge, MA 02139, USA.  */
 
 /* Return a string describing the errno code in ERRNUM.  */
 char *
-_strerror_internal (int errnum, char buf[1024])
+_strerror_internal (int errnum, char *buf, size_t buflen)
 {
   int system; 
   int sub;
@@ -41,7 +41,7 @@ _strerror_internal (int errnum, char buf[1024])
   if (system > err_max_system || ! __mach_error_systems[system].bad_sub)
     {
       static const char unk[] = "Error in unknown error system: ";
-      char *p = buf + sizeof buf;
+      char *p = buf + buflen;
       *p-- = '\0';
       p = _itoa (errnum, p, 16, 1);
       p -= sizeof unk - 1;
@@ -56,7 +56,7 @@ _strerror_internal (int errnum, char buf[1024])
   if (code >= es->subsystem[sub].max_code)
     {
       static const char unk[] = "Unknown error ";
-      char *p = buf + sizeof buf;
+      char *p = buf + buflen;
       size_t len = strlen (es->subsystem[sub].subsys_name);
       *p-- = '\0';
       p = _itoa (errnum, p, 16, 1);
diff --git a/sysdeps/mach/hurd/ttyname_r.c b/sysdeps/mach/hurd/ttyname_r.c
new file mode 100644
index 0000000000..67ff37d61c
--- /dev/null
+++ b/sysdeps/mach/hurd/ttyname_r.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 1994, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <hurd.h>
+#include <hurd/term.h>
+#include <hurd/fd.h>
+
+/* Store at most BUFLEN characters of the pathname of the terminal FD is
+   open on in BUF.  Return 0 on success, -1 otherwise.  */
+int
+ttyname_r (int fd, char *buf, int buflen)
+{
+  error_t err;
+  char nodename[1024];	/* XXX */
+  char *cp;
+  int len;
+
+  nodename[0] = '\0';
+  if (err = HURD_DPORT_USE (fd, __term_get_nodename (port, nodename)))
+    return __hurd_dfail (fd, err), -1;
+
+  len = (int) strlen (nodename) + 1;
+  if (len > buflen)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  memcpy (buf, nodename, len);
+  return 0;
+}
diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c
index 7f4fbb7261..485f9b3df4 100644
--- a/sysdeps/posix/sysconf.c
+++ b/sysdeps/posix/sysconf.c
@@ -52,7 +52,11 @@ DEFUN(__sysconf, (name), int name)
 #endif
 
     case _SC_CLK_TCK:
+#ifdef	CLK_TCK
+      return CLK_TCK;
+#else
       return 60;
+#endif
 
     case _SC_NGROUPS_MAX:
 #ifdef	NGROUPS_MAX
@@ -65,7 +69,11 @@ DEFUN(__sysconf, (name), int name)
       return __getdtablesize ();
 
     case _SC_STREAM_MAX:
+#ifdef	STREAM_MAX
+      return STREAM_MAX;
+#else
       return FOPEN_MAX;
+#endif
 
     case _SC_TZNAME_MAX:
       return __tzname_max ();
@@ -171,6 +179,13 @@ DEFUN(__sysconf, (name), int name)
       return -1;
 #endif
 
+    case _SC_2_LOCALEDEF:
+#ifdef	_POSIX2_LOCALEDEF
+      return _POSIX2_LOCALEDEF;
+#else
+      return -1;
+#endif
+
     case _SC_2_SW_DEV:
 #ifdef	_POSIX2_SW_DEV
       return _POSIX2_SW_DEV;
diff --git a/sysdeps/posix/ttyname_r.c b/sysdeps/posix/ttyname_r.c
new file mode 100644
index 0000000000..e225da2be2
--- /dev/null
+++ b/sysdeps/posix/ttyname_r.c
@@ -0,0 +1,91 @@
+/* Copyright (C) 1991, 1992, 1993, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <errno.h>
+#include <limits.h>
+#include <stddef.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+
+#ifndef MIN
+# define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+/* Store at most BUFLEN character of the pathname of the terminal FD is
+   open on in BUF.  Return 0 on success, -1 otherwise.  */
+int
+ttyname_r (fd, buf, buflen)
+     int fd;
+     char *buf;
+     int buflen;
+{
+  static const char dev[] = "/dev";
+  struct stat st;
+  dev_t mydev;
+  ino_t myino;
+  DIR *dirstream;
+  struct dirent *d;
+  int save = errno;
+
+  /* Test for the absolute minimal size.  This makes life easier inside
+     the loop.  */
+  if (buflen < sizeof (dev) + 2)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  if (fstat (fd, &st) < 0)
+    return -1;
+  mydev = st.st_dev;
+  myino = st.st_ino;
+
+  dirstream = opendir (dev);
+  if (dirstream == NULL)
+    return -1;
+
+  /* Prepare the result buffer.  */
+  memcpy (buf, dev, sizeof (dev));
+  buf[sizeof (dev)] = '/';
+  buflen -= sizeof (dev) + 1;
+
+  while ((d = readdir (dirstream)) != NULL)
+    if (d->d_fileno == myino)
+      {
+	char *cp;
+
+	cp = stpncpy (&buf[sizeof (dev) + 1], d->d_name,
+		      MIN (d->d_namlen + 1, buflen));
+	cp[0] = '\0';
+
+	if (stat (buf, &st) == 0 && st.st_dev == mydev)
+	  {
+	    (void) closedir (dirstream);
+	    errno = save;
+	    return 0;
+	  }
+      }
+
+  (void) closedir (dirstream);
+  errno = save;
+  return -1;
+}
diff --git a/sysdeps/posix/utimes.c b/sysdeps/posix/utimes.c
index ca542c68b1..2c92803cbc 100644
--- a/sysdeps/posix/utimes.c
+++ b/sysdeps/posix/utimes.c
@@ -16,6 +16,7 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
+#include <utime.h>
 #include <sys/time.h>
 #include <errno.h>
 #include <stddef.h>
@@ -36,7 +37,7 @@ __utimes (const char *file, struct timeval tvp[2])
   else
     times = NULL;
 
-  return utime (path, times);
+  return utime (file, times);
 }
 
 weak_alias (__utimes, utimes)
diff --git a/sysdeps/stub/msgctl.c b/sysdeps/stub/msgctl.c
new file mode 100644
index 0000000000..8212f096c1
--- /dev/null
+++ b/sysdeps/stub/msgctl.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/msg.h>
+#include <errno.h>
+
+/* Allows to control internal state and destruction of message queue
+   objects.  */
+
+int
+msgctl (msqid, cmd, buf)
+     int msqid;
+     int cmd;
+     struct msqid_ds *buf;
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+stub_warning (msgctl)
diff --git a/sysdeps/stub/msgget.c b/sysdeps/stub/msgget.c
new file mode 100644
index 0000000000..3ee2b3dacd
--- /dev/null
+++ b/sysdeps/stub/msgget.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/msg.h>
+#include <errno.h>
+
+/* Return descriptor for message queue associated with KEY.  The MSGFLG
+   parameter describes how to proceed with clashing of key values.  */
+
+int
+msgget (key, msgflg)
+     key_t key;
+     int msgflg;
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+stub_warning (msgget)
diff --git a/sysdeps/stub/msgrcv.c b/sysdeps/stub/msgrcv.c
new file mode 100644
index 0000000000..3d5dfc5523
--- /dev/null
+++ b/sysdeps/stub/msgrcv.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/msg.h>
+#include <errno.h>
+
+/* Read a message from the queue associated with the message queue
+   descriptor MSQID.  At most MSGSZ bytes of the message are placed
+   in the buffer specified by the MSGP parameter.  The MSGTYP parameter
+   describes which message is returned in MSGFLG describes the behaviour
+   in buffer overflow or queue underflow.  */
+
+int
+msgrcv (msqid, msgp, msgsz, msgtyp, msgflg)
+     int msqid;
+     void *msgp;
+     size_t msgsz;
+     long msgtyp;
+     int msgflg;
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+stub_warning (msgrcv)
diff --git a/sysdeps/stub/msgsnd.c b/sysdeps/stub/msgsnd.c
new file mode 100644
index 0000000000..77d188017d
--- /dev/null
+++ b/sysdeps/stub/msgsnd.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/msg.h>
+#include <errno.h>
+
+/* Send a message to the queue associated with the message queue
+   descriptor MSQID.  The parameter MSGP points to a structure
+   describing messages where the parameter MSGSZ gives the length
+   of the text.  The MSGFLG parameter describes the action taken
+   when the limit of the message queue length is reached.  */
+
+int
+msgsnd (msqid, msgp, msgsz, msgflg)
+     int msqid;
+     void *msgp;
+     size_t msgsz;
+     int msgflg;
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+stub_warning (msgsnd)
diff --git a/sysdeps/stub/semctl.c b/sysdeps/stub/semctl.c
new file mode 100644
index 0000000000..8f2fe99400
--- /dev/null
+++ b/sysdeps/stub/semctl.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/sem.h>
+#include <errno.h>
+
+/* Return identifier for array of NSEMS semaphores associated with
+   KEY.  */
+
+int
+semctl (semid, semnum, cmd, arg)
+     int semid;
+     int semnum;
+     int cmd;
+     union semun arg;
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+stub_warning (semctl)
diff --git a/sysdeps/stub/semget.c b/sysdeps/stub/semget.c
new file mode 100644
index 0000000000..3ccf2717d4
--- /dev/null
+++ b/sysdeps/stub/semget.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/sem.h>
+#include <errno.h>
+
+/* Return identifier for array of NSEMS semaphores associated with
+   KEY.  */
+
+int
+semget (key, nsems, semflg)
+     key_t key;
+     int nsems;
+     int semflg;
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+stub_warning (semget)
diff --git a/sysdeps/stub/semop.c b/sysdeps/stub/semop.c
new file mode 100644
index 0000000000..2bba8628e6
--- /dev/null
+++ b/sysdeps/stub/semop.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/sem.h>
+#include <errno.h>
+
+/* Perform user-defined atomical operation of array of semaphores.  */
+
+int
+semop (semid, sops, nsops)
+     int semid;
+     struct sembuf *sops;
+     unsigned int nsops;
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+stub_warning (semop)
diff --git a/sysdeps/stub/shmat.c b/sysdeps/stub/shmat.c
new file mode 100644
index 0000000000..099f2279d2
--- /dev/null
+++ b/sysdeps/stub/shmat.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/shm.h>
+#include <errno.h>
+
+/* Attach the shared memory segment associated with SHMID to the data
+   segment of the calling process.  SHMADDR and SHMFLG determine how
+   and where the segment is attached.  */
+
+char *
+shmat (shmid, shmaddr, shmflg)
+     int shmid;
+     char *shmaddr;
+     int shmflg;
+{
+  errno = ENOSYS;
+  return (char *) -1;
+}
+
+stub_warning (shmat)
diff --git a/sysdeps/stub/shmctl.c b/sysdeps/stub/shmctl.c
new file mode 100644
index 0000000000..75a4613166
--- /dev/null
+++ b/sysdeps/stub/shmctl.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/shm.h>
+#include <errno.h>
+
+/* Provide operations to control over shared memory segments.  */
+
+int
+shmctl (shmid, cmd, buf)
+     int shmid;
+     int cmd;
+     struct shmid_ds *buf;
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+stub_warning (shmctl)
diff --git a/sysdeps/stub/shmdt.c b/sysdeps/stub/shmdt.c
new file mode 100644
index 0000000000..8affa6c15a
--- /dev/null
+++ b/sysdeps/stub/shmdt.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/shm.h>
+#include <errno.h>
+
+/* Detach shared memory segment starting at address specified by SHMADDR
+   from the caller's data segment.  */
+
+int
+shmdt (shmaddr)
+     char *shmaddr;
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+stub_warning (shmdt)
diff --git a/sysdeps/stub/shmget.c b/sysdeps/stub/shmget.c
new file mode 100644
index 0000000000..d59ff90c99
--- /dev/null
+++ b/sysdeps/stub/shmget.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/shm.h>
+#include <errno.h>
+
+/* Return an identifier for an shared memory segment of at least size SIZE
+   which is associated with KEY.  */
+
+int
+shmget (key, size, shmflg)
+     key_t key;
+     int size;
+     int shmflg;
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+stub_warning (shmget)
diff --git a/sysdeps/stub/sys/ipc_buf.h b/sysdeps/stub/sys/ipc_buf.h
new file mode 100644
index 0000000000..fc2ad03873
--- /dev/null
+++ b/sysdeps/stub/sys/ipc_buf.h
@@ -0,0 +1,58 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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.  */
+
+#ifndef _SYS_IPC_BUF_H
+#define _SYS_IPC_BUF_H
+
+#include <features.h>
+#include <sys/types.h>
+
+/* Mode bits for `msgget', `semget', and `shmget'.  */
+#define IPC_CREAT	01000		/* create key if key does not exist */
+#define IPC_EXCL	02000		/* fail if key exists */
+#define IPC_NOWAIT	04000		/* return error on wait */
+
+/* Control commands for `msgctl', `semctl', and `shmctl'.  */
+#define IPC_RMID	0		/* remove identifier */
+#define IPC_SET		1		/* set `ipc_perm' options */
+#define IPC_STAT	2		/* get `ipc_perm' options */
+
+
+__BEGIN_DECLS
+
+/* Data type for key value.  */
+typedef int key_t;
+
+/* Special key values.  */
+#define IPC_PRIVATE	((key_t) 0)	/* private key */
+
+
+/* Data structure used to pass permission information to IPC operations.  */
+struct ipc_perm
+{
+  __uid_t uid;				/* owner's user ID */
+  __gid_t gid;				/* owner's group ID */
+  __uid_t cuid;				/* creator's user ID */
+  __gid_t cgid;				/* creator's group ID */
+  __mode_t mode;			/* read/write permission */
+};
+
+__END_DECLS
+
+#endif /* sys/ipc_buf.h */
diff --git a/sysdeps/stub/sys/msq_buf.h b/sysdeps/stub/sys/msq_buf.h
new file mode 100644
index 0000000000..0222a652ab
--- /dev/null
+++ b/sysdeps/stub/sys/msq_buf.h
@@ -0,0 +1,47 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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.  */
+
+#ifndef _SYS_MSQ_BUF_H
+#define _SYS_MSQ_BUF_H
+
+#include <features.h>
+#include <sys/types.h>
+
+/* Define options for message queue functions.  */
+#define MSG_NOERROR	010000	/* no error if message is too big */
+
+__BEGIN_DECLS
+
+/* Structure of record for one message inside the kernel.
+   The type `struct __msg' is opaque.  */
+struct msqid_ds
+{
+  struct ipc_perm msg_perm;	/* structure describing operation permission */
+  __time_t msg_stime;		/* time of last msgsnd command */
+  __time_t msg_rtime;		/* time of last msgrcv command */
+  __time_t msg_ctime;		/* time of last change */
+  unsigned short int msg_qnum;	/* number of messages currently on queue */
+  unsigned short int msg_qbytes;/* max number of bytes allowed on queue */
+  __pid_t msg_lspid;		/* pid of last msgsnd() */
+  __pid_t msg_lrpid;		/* pid of last msgrcv() */
+};
+
+__END_DECLS
+
+#endif /* sys/msq_buf.h */
diff --git a/sysdeps/stub/sys/sem_buf.h b/sysdeps/stub/sys/sem_buf.h
new file mode 100644
index 0000000000..b301525408
--- /dev/null
+++ b/sysdeps/stub/sys/sem_buf.h
@@ -0,0 +1,52 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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.  */
+
+#ifndef _SYS_SEM_BUF_H
+#define _SYS_SEM_BUF_H
+
+#include <features.h>
+#include <sys/types.h>
+
+/* Flags for `semop'.  */
+#define SEM_UNDO	0x1000		/* undo the operation on exit */
+
+/* Commands for `semctl'.  */
+#define GETPID		11		/* get sempid */
+#define GETVAL		12		/* get semval */
+#define GETALL		13		/* get all semval's */
+#define GETNCNT		14		/* get semncnt */
+#define GETZCNT		15		/* get semzcnt */
+#define SETVAL		16		/* set semval */
+#define SETALL		17		/* set all semval's */
+
+
+__BEGIN_DECLS
+
+/* Data structure describing a set of semaphores.  */
+struct semid_ds
+{
+  struct ipc_perm sem_perm;		/* operation permisson struct */
+  __time_t sem_otime;			/* last semop() time */
+  __time_t sem_ctime;			/* last time changed by semctl() */
+  unsigned short int sem_nsems;		/* number of semaphores in set */
+};
+
+__END_DECLS
+
+#endif /* sys/sem_buf.h */
diff --git a/sysdeps/stub/sys/shm_buf.h b/sysdeps/stub/sys/shm_buf.h
new file mode 100644
index 0000000000..c665d6c160
--- /dev/null
+++ b/sysdeps/stub/sys/shm_buf.h
@@ -0,0 +1,53 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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.  */
+
+#ifndef _SYS_SHM_BUF_H
+#define _SYS_SHM_BUF_H
+
+#include <features.h>
+#include <sys/types.h>
+
+/* Flags for `shmat'.  */
+#define SHM_RDONLY	010000		/* attach read-only else read-write */
+#define SHM_RND		020000		/* round attach address to SHMLBA */
+#define SHM_REMAP	040000		/* take-over region on attach */
+
+/* Commands for `shmctl'.  */
+#define SHM_LOCK	11		/* lock segment (root only) */
+#define SHM_UNLOCK	12		/* unlock segment (root only) */
+
+
+__BEGIN_DECLS
+
+/* Data structure describing a set of semaphores.  */
+struct shmid_ds
+{
+  struct ipc_perm sem_perm;		/* operation permisson struct */
+  int shm_segsz;			/* size of segment in bytes */
+  __time_t sem_atime;			/* time of last shmat() */
+  __time_t sem_dtime;			/* time of last shmdt() */
+  __time_t sem_ctime;			/* time of last change by shmctl() */
+  __pid_t shm_cpid;			/* pid of creator */
+  __pid_t shm_lpid;			/* pid of last shmop */
+  unsigned short int shm_nattch;	/* number of current attaches */
+};
+
+__END_DECLS
+
+#endif /* sys/shm_buf.h */
diff --git a/sysdeps/stub/ttyname_r.c b/sysdeps/stub/ttyname_r.c
new file mode 100644
index 0000000000..875929e3f3
--- /dev/null
+++ b/sysdeps/stub/ttyname_r.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 1991, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+
+/* Store at most BUFLEN characters the pathname of the terminal FD is
+   open on in BUF.  Return 0 on success, -1 otherwise.  */
+int
+ttyname_r (fd, buf, buflen)
+     int fd;
+     char *buf;
+     int buflen;
+{
+  errno = ENOSYS;
+  return -1;
+}
+
+
+#ifdef	 HAVE_GNU_LD
+
+#include <gnu-stabs.h>
+
+stub_warning(ttyname_r);
+
+#endif	/* GNU stabs.  */