summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/alpha/machine-gmon.h5
-rw-r--r--sysdeps/generic/gnu/types.h1
-rw-r--r--sysdeps/generic/machine-gmon.h2
-rw-r--r--sysdeps/generic/pty.c2
-rw-r--r--sysdeps/generic/strtok.c2
-rw-r--r--sysdeps/generic/strtok_r.c2
-rw-r--r--sysdeps/gnu/errlist.awk2
-rw-r--r--sysdeps/gnu/errlist.c2
-rw-r--r--sysdeps/posix/euidaccess.c2
-rw-r--r--sysdeps/posix/sigvec.c3
-rw-r--r--sysdeps/posix/tempname.c19
-rw-r--r--sysdeps/stub/chflags.c3
-rw-r--r--sysdeps/stub/fchflags.c3
-rw-r--r--sysdeps/stub/sstk.c3
-rw-r--r--sysdeps/unix/Makefile3
-rw-r--r--sysdeps/unix/alpha/sysdep.S7
-rw-r--r--sysdeps/unix/readdir.c6
-rw-r--r--sysdeps/unix/readdir_r.c108
-rw-r--r--sysdeps/unix/sysv/linux/gnu/types.h2
-rw-r--r--sysdeps/unix/sysv/linux/init-first.c4
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list2
21 files changed, 158 insertions, 25 deletions
diff --git a/sysdeps/alpha/machine-gmon.h b/sysdeps/alpha/machine-gmon.h
index a551e9f8b1..e902537dd6 100644
--- a/sysdeps/alpha/machine-gmon.h
+++ b/sysdeps/alpha/machine-gmon.h
@@ -1,5 +1,5 @@
 /* Machine-specific calling sequence for `mcount' profiling function.  alpha
-Copyright (C) 1995 Free Software Foundation, Inc.
+Copyright (C) 1995, 1996 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
@@ -17,7 +17,8 @@ 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.  */
 
-#define _MCOUNT_DECL void __mcount
+#define _MCOUNT_DECL(from, self) \
+ void __mcount (u_long from, u_long self)
 
 /* Call __mcount with our the return PC for our caller, and the return
    PC our caller will return to.  Empty since we use an assembly stub
diff --git a/sysdeps/generic/gnu/types.h b/sysdeps/generic/gnu/types.h
index 614252aaac..f42fb7f544 100644
--- a/sysdeps/generic/gnu/types.h
+++ b/sysdeps/generic/gnu/types.h
@@ -57,6 +57,7 @@ typedef long int __daddr_t;	/* The type of a disk address.  */
 typedef char *__caddr_t;
 typedef long int __time_t;
 typedef long int __swblk_t;	/* Type of a swap block maybe?  */
+typedef long int __key_t;	/* Type of an IPC key */
 
 /* fd_set for select.  */
 
diff --git a/sysdeps/generic/machine-gmon.h b/sysdeps/generic/machine-gmon.h
index 43bf62d663..31f852dece 100644
--- a/sysdeps/generic/machine-gmon.h
+++ b/sysdeps/generic/machine-gmon.h
@@ -41,7 +41,7 @@ weak_alias (_mcount, mcount)
 static void mcount_internal (u_long frompc, u_long selfpc);
 
 #define _MCOUNT_DECL(frompc, selfpc) \
-static inline void mcount_internal (frompc, selfpc)
+static inline void mcount_internal (u_long frompc, u_long selfpc)
 
 #define MCOUNT \
 void _mcount (void)							      \
diff --git a/sysdeps/generic/pty.c b/sysdeps/generic/pty.c
index 6995417d3a..8df8aba4ba 100644
--- a/sysdeps/generic/pty.c
+++ b/sysdeps/generic/pty.c
@@ -47,6 +47,7 @@ static char sccsid[] = "@(#)pty.c	8.1 (Berkeley) 6/4/93";
 #include <string.h>
 #include <grp.h>
 #include <pty.h>
+#include <utmp.h>
 
 int
 openpty(amaster, aslave, name, termp, winp)
@@ -106,7 +107,6 @@ forkpty(amaster, name, termp, winp)
 	struct termios *termp;
 	struct winsize *winp;
 {
-	extern int login_tty __P ((int fd));
 	int master, slave, pid;
 
 	if (openpty(&master, &slave, name, termp, winp) == -1)
diff --git a/sysdeps/generic/strtok.c b/sysdeps/generic/strtok.c
index cb30619a43..4f89efa6f0 100644
--- a/sysdeps/generic/strtok.c
+++ b/sysdeps/generic/strtok.c
@@ -53,7 +53,7 @@ strtok (s, delim)
   s = strpbrk (token, delim);
   if (s == NULL)
     /* This token finishes the string.  */
-    olds = NULL;
+    olds = strchr (token, '\0');
   else
     {
       /* Terminate the token and make OLDS point past it.  */
diff --git a/sysdeps/generic/strtok_r.c b/sysdeps/generic/strtok_r.c
index 488d3eacfe..870fb274eb 100644
--- a/sysdeps/generic/strtok_r.c
+++ b/sysdeps/generic/strtok_r.c
@@ -54,7 +54,7 @@ strtok_r (s, delim, save_ptr)
   s = strpbrk (token, delim);
   if (s == NULL)
     /* This token finishes the string.  */
-    *save_ptr = NULL;
+    *save_ptr = strchr (token, '\0');
   else
     {
       /* Terminate the token and make *SAVE_PTR point past it.  */
diff --git a/sysdeps/gnu/errlist.awk b/sysdeps/gnu/errlist.awk
index c68e70df9a..a640fe5a11 100644
--- a/sysdeps/gnu/errlist.awk
+++ b/sysdeps/gnu/errlist.awk
@@ -32,7 +32,7 @@ BEGIN {
     print "";
     print "#include <errno.h>";
     print "";
-    print "const char *_sys_errlist[] =";
+    print "const char *const _sys_errlist[] =";
     print "  {";
     print "    [0] = N_(\"Success\"),"
   }
diff --git a/sysdeps/gnu/errlist.c b/sysdeps/gnu/errlist.c
index 85ae7f11ac..3e62c5f127 100644
--- a/sysdeps/gnu/errlist.c
+++ b/sysdeps/gnu/errlist.c
@@ -2,7 +2,7 @@
 
 #include <errno.h>
 
-const char *_sys_errlist[] =
+const char *const _sys_errlist[] =
   {
     [0] = N_("Success"),
 #ifdef EPERM
diff --git a/sysdeps/posix/euidaccess.c b/sysdeps/posix/euidaccess.c
index 26f3af6374..f3a10c9b9c 100644
--- a/sysdeps/posix/euidaccess.c
+++ b/sysdeps/posix/euidaccess.c
@@ -67,7 +67,7 @@ gid_t getegid ();
 extern int errno;
 #endif
 #ifndef __set_errno
-#define __set_errno(val) errno = 8val)
+#define __set_errno(val) errno = (val)
 #endif
 
 #if defined(EACCES) && !defined(EACCESS)
diff --git a/sysdeps/posix/sigvec.c b/sysdeps/posix/sigvec.c
index 6a224e1733..7e9aeb368e 100644
--- a/sysdeps/posix/sigvec.c
+++ b/sysdeps/posix/sigvec.c
@@ -26,6 +26,9 @@ Cambridge, MA 02139, USA.  */
 static __sighandler_t wrapped_handlers[NSIG];
 static sigset_t wrapped_masks[NSIG];
 
+static void wrapper_handler __P ((int sig));
+static inline int convert_mask __P ((sigset_t *set, const int mask));
+
 static void
 wrapper_handler (sig)
      int sig;
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index d58024fe7e..61774a0b3e 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -150,7 +150,7 @@ __stdio_gen_tempname (char *buf, size_t bufsize, const char *dir,
   len = dlen + 1 + plen + 5 + 3;
   while (1)
     {
-      const size_t i;
+      size_t i;
 
       if (*idx >= ((sizeof (letters) - 1) * (sizeof (letters) - 1) *
 		   (sizeof (letters) - 1)))
@@ -193,11 +193,18 @@ __stdio_gen_tempname (char *buf, size_t bufsize, const char *dir,
 		 Create a stream for it.  */
 #ifdef USE_IN_LIBIO
 	      int save;
+	      struct locked_FILE
+		{
+		  struct _IO_FILE_plus fp;
+#ifdef _IO_MTSAFE_IO
+		  _IO_lock_t lock;
+#endif
+		} *new_f;
 	      struct _IO_FILE_plus *fp;
 
-	      fp = (struct _IO_FILE_plus *)
-		malloc (sizeof (struct _IO_FILE_plus));
-	      if (fp == NULL)
+	      new_f = (struct locked_FILE *)
+		malloc (sizeof (struct locked_FILE));
+	      if (new_f == NULL)
 		{
 		  /* We lost trying to create a stream (out of memory?).
 		     Nothing to do but remove the file, close the descriptor,
@@ -209,6 +216,10 @@ __stdio_gen_tempname (char *buf, size_t bufsize, const char *dir,
 		  __set_errno (save);
 		  return NULL;
 		}
+	      fp = &new_f->fp;
+#ifdef _IO_MTSAFE_IO
+	      fp->file._lock = &new_f->lock;
+#endif
 	      _IO_init (&fp->file, 0);
 	      _IO_JUMPS (&fp->file) = &_IO_file_jumps;
 	      _IO_file_init (&fp->file);
diff --git a/sysdeps/stub/chflags.c b/sysdeps/stub/chflags.c
index 9380108283..18100cad90 100644
--- a/sysdeps/stub/chflags.c
+++ b/sysdeps/stub/chflags.c
@@ -21,6 +21,9 @@ Cambridge, MA 02139, USA.  */
 #include <sys/stat.h>
 
 /* Change the flags of FILE to FLAGS.  */
+
+int chflags __P ((const char *file, int flags));
+
 int
 chflags (file, flags)
      const char *file;
diff --git a/sysdeps/stub/fchflags.c b/sysdeps/stub/fchflags.c
index 4f59ad3480..21a66e8bd5 100644
--- a/sysdeps/stub/fchflags.c
+++ b/sysdeps/stub/fchflags.c
@@ -21,6 +21,9 @@ Cambridge, MA 02139, USA.  */
 #include <sys/stat.h>
 
 /* Change the flags of the file FD refers to to FLAGS.  */
+
+int fchflags __P ((int fd, int flags));
+
 int
 fchflags (fd, flags)
      int fd;
diff --git a/sysdeps/stub/sstk.c b/sysdeps/stub/sstk.c
index d7486737fa..aa1bfb2e73 100644
--- a/sysdeps/stub/sstk.c
+++ b/sysdeps/stub/sstk.c
@@ -20,6 +20,9 @@ Cambridge, MA 02139, USA.  */
 
 /* Increase the size of the stack by INCREMENT,
    and return the address of the bottom of the stack.  */
+
+void *sstk __P ((int increment));
+
 void *
 sstk (increment)
      int increment;
diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile
index d3cc46ab31..78eecd5296 100644
--- a/sysdeps/unix/Makefile
+++ b/sysdeps/unix/Makefile
@@ -302,7 +302,8 @@ ifndef no_deps
 endif
 endif
 
-$(common-objpfx)s-proto.d: $(..)sysdeps/unix/s-proto.S $(before-compile)
+$(common-objpfx)s-proto.d: $(common-objpfx)%.d: $(..)sysdeps/unix/%.S \
+			   $(before-compile)
 	$(+make-deps)
 
 endif
diff --git a/sysdeps/unix/alpha/sysdep.S b/sysdeps/unix/alpha/sysdep.S
index 8d70bda21e..08dc3b4851 100644
--- a/sysdeps/unix/alpha/sysdep.S
+++ b/sysdeps/unix/alpha/sysdep.S
@@ -27,6 +27,8 @@ errno:	.space 4
 	.type errno, @object
 	.size errno, 4
 #endif
+	.globl __errno
+__errno = errno
 
 	.text
 	.align 2
@@ -44,7 +46,10 @@ __syscall_error:
 	.mask	0x4000001, -16
 	.prologue 1
 
-	/* Find our pre-thread errno address  */
+	/* Store into the "real" variable.  */
+	stl	v0, errno
+
+	/* Find our per-thread errno address  */
 	jsr	ra, __errno_location
 
 	/* Store the error value.  */
diff --git a/sysdeps/unix/readdir.c b/sysdeps/unix/readdir.c
index 491469bcd1..97956ecd06 100644
--- a/sysdeps/unix/readdir.c
+++ b/sysdeps/unix/readdir.c
@@ -34,12 +34,6 @@ __readdir (DIR *dirp)
 {
   struct dirent *dp;
 
-  if (dirp == NULL || dirp->data == NULL)
-    {
-      __set_errno (EINVAL);
-      return NULL;
-    }
-
   __libc_lock_lock (dirp->lock);
 
   do
diff --git a/sysdeps/unix/readdir_r.c b/sysdeps/unix/readdir_r.c
new file mode 100644
index 0000000000..ef75c36234
--- /dev/null
+++ b/sysdeps/unix/readdir_r.c
@@ -0,0 +1,108 @@
+/* Copyright (C) 1991, 92, 93, 94, 95, 96 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 <string.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <assert.h>
+
+#include <dirstream.h>
+
+
+/* Read a directory entry from DIRP.  */
+int
+__readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
+{
+  struct dirent *dp;
+
+  __libc_lock_lock (dirp->lock);
+
+  do
+    {
+      size_t reclen;
+
+      if (dirp->offset >= dirp->size)
+	{
+	  /* We've emptied out our buffer.  Refill it.  */
+
+	  size_t maxread;
+	  off_t base;
+	  ssize_t bytes;
+
+#ifndef _DIRENT_HAVE_D_RECLEN
+	  /* Fixed-size struct; must read one at a time (see below).  */
+	  maxread = sizeof *dp;
+#else
+	  maxread = dirp->allocation;
+#endif
+
+	  base = dirp->filepos;
+	  bytes = __getdirentries (dirp->fd, dirp->data, maxread, &base);
+	  if (bytes <= 0)
+	    {
+	      dp = NULL;
+	      break;
+	    }
+	  dirp->size = (size_t) bytes;
+
+	  /* Reset the offset into the buffer.  */
+	  dirp->offset = 0;
+	}
+
+      dp = (struct dirent *) &dirp->data[dirp->offset];
+
+#ifdef _DIRENT_HAVE_D_RECLEN
+      reclen = dp->d_reclen;
+#else
+      /* The only version of `struct dirent' that lacks `d_reclen'
+	 is fixed-size.  */
+      assert (sizeof dp->d_name > 1);
+      reclen = sizeof *dp;
+      /* The name is not terminated if it is the largest possible size.
+	 Clobber the following byte to ensure proper null termination.  We
+	 read just one entry at a time above so we know that byte will not
+	 be used later.  */
+      dp->d_name[sizeof dp->d_name] = '\0';
+#endif
+
+      dirp->offset += reclen;
+
+#ifdef _DIRENT_HAVE_D_OFF
+      dirp->filepos = dp->d_off;
+#else
+      dirp->filepos += reclen;
+#endif
+
+      /* Skip deleted files.  */
+    } while (dp->d_ino == 0);
+
+  if (dp != NULL)
+    {
+      *entry = *dp;
+      *result = entry;
+    }
+
+  __libc_lock_unlock (dirp->lock);
+
+  return dp != NULL ? 0 : -1;
+}
+weak_alias (__readdir_r, readdir_r)
diff --git a/sysdeps/unix/sysv/linux/gnu/types.h b/sysdeps/unix/sysv/linux/gnu/types.h
index 745d2d8e2e..5495b61aa4 100644
--- a/sysdeps/unix/sysv/linux/gnu/types.h
+++ b/sysdeps/unix/sysv/linux/gnu/types.h
@@ -71,7 +71,7 @@ typedef __kernel_clock_t __clock_t;
 typedef unsigned long __fd_mask;
 
 #ifdef	__USE_SVID
-typedef int key_t;
+typedef int __key_t;
 #endif
 
 #endif /* gnu/types.h */
diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
index 75ada19610..6e1d71204c 100644
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ b/sysdeps/unix/sysv/linux/init-first.c
@@ -21,7 +21,7 @@ Cambridge, MA 02139, USA.  */
 #include <sysdep.h>
 #include <fpu_control.h>
 #include <linux/personality.h>
-#include "init-first.h"
+#include <init-first.h>
 
 extern void __libc_init (int, char **, char **);
 extern void __libc_global_ctors (void);
@@ -95,7 +95,7 @@ SYSDEP_CALL_INIT(__libc_init_first, init);
    cause ld.so to gain an init function, which is not a cool thing. */
 
 void
-_dl_start ()
+_dl_start (void)
 {
   abort ();
 }
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index f831b41072..1dd2f4d7e7 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -19,7 +19,7 @@ ioperm		-	ioperm		3	ioperm
 iopl		-	iopl		1	iopl
 ipc		msgget	ipc		5	__ipc
 klogctl		EXTRA	syslog		3	klogctl
-llseek		EXTRA	_llseek		5	llseek
+llseek		EXTRA	_llseek		5	_llseek
 mlock		EXTRA	mlock		2	__mlock	mlock
 mlockall	EXTRA	mlockall	1	__mlockall	mlockall
 mount		EXTRA	mount		5	__mount	mount