summary refs log tree commit diff
diff options
context:
space:
mode:
authorThomas Bushnell, BSG <thomas@gnu.org>1996-11-15 19:50:04 +0000
committerThomas Bushnell, BSG <thomas@gnu.org>1996-11-15 19:50:04 +0000
commitebe3b3ebb7cf39cf3c64a2c69e5a71e2b53fe73f (patch)
treef15f3170c01642634de7bb7e27d3cf01cd8a72ca
parent63afd6ae4063981afa88e90f8b2b3653433fdcb8 (diff)
downloadglibc-ebe3b3ebb7cf39cf3c64a2c69e5a71e2b53fe73f.tar.gz
glibc-ebe3b3ebb7cf39cf3c64a2c69e5a71e2b53fe73f.tar.xz
glibc-ebe3b3ebb7cf39cf3c64a2c69e5a71e2b53fe73f.zip
Fri Nov 15 12:27:25 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
	* sysdeps/posix/readv.c (readv): Change return type to ssize_t.
  	Deansideclized.
	* sysdeps/posix/writev.c (writev): Likewise.
-rw-r--r--hurd/hurdmalloc.c21
-rw-r--r--mach/mach.h10
-rw-r--r--mach/msg-destroy.c15
-rw-r--r--manual/errno.texi129
-rw-r--r--stdio-common/vfscanf.c2
-rw-r--r--stdio/fopen.c4
-rw-r--r--stdio/internals.c16
-rw-r--r--stdio/memstream.c12
-rw-r--r--stdio/stdio.h2
-rw-r--r--sysdeps/mach/hurd/i386/init-first.c2
-rw-r--r--sysdeps/mach/hurd/ioctl.c2
-rw-r--r--sysdeps/mach/hurd/lchown.c44
-rw-r--r--sysdeps/mach/hurd/select.c191
-rw-r--r--sysdeps/mach/hurd/statbuf.h16
-rw-r--r--sysdeps/posix/readv.c11
-rw-r--r--sysdeps/posix/writev.c11
16 files changed, 287 insertions, 201 deletions
diff --git a/hurd/hurdmalloc.c b/hurd/hurdmalloc.c
index 5f719df9c6..d95b0c34dd 100644
--- a/hurd/hurdmalloc.c
+++ b/hurd/hurdmalloc.c
@@ -37,6 +37,14 @@
 /*
  * HISTORY
  * $Log$
+ * Revision 1.12  1996/11/15 19:44:13  thomas
+ * Tue Nov 12 16:58:41 1996  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>
+ *
+ * 	* mach/msg-destroy.c (mach_msg_destroy_port,
+ * 	mach_msg_destroy_memory): Use prototype	syntax.
+ * 	* hurd/hurdmalloc.c (more_memory, malloc_fork_prepare,
+ * 	malloc_fork_parent, malloc_fork_child): Likewise.
+ *
  * Revision 1.11  1996/06/06 15:13:47  miles
  * Changes to bring in line with the hurd libthreads/malloc.c:
  *   (more_memory): Use assert_perror instead of MACH_CALL.
@@ -206,9 +214,7 @@ malloc_init (void)
 }
 
 static void
-more_memory(size, fl)
-	int size;
-	register free_list_t fl;
+more_memory(int size, free_list_t fl)
 {
 	register int amount;
 	register int n;
@@ -448,7 +454,8 @@ print_malloc_free_list()
 }
 #endif	DEBUG
 
-static void malloc_fork_prepare()
+static void 
+malloc_fork_prepare(void)
 /*
  * Prepare the malloc module for a fork by insuring that no thread is in a
  * malloc critical section.
@@ -461,7 +468,8 @@ static void malloc_fork_prepare()
     }
 }
 
-static void malloc_fork_parent()
+static void 
+malloc_fork_parent(void)
 /*
  * Called in the parent process after a fork() to resume normal operation.
  */
@@ -473,7 +481,8 @@ static void malloc_fork_parent()
     }
 }
 
-static void malloc_fork_child()
+static void
+malloc_fork_child(void)
 /*
  * Called in the child process after a fork() to resume normal operation.
  */
diff --git a/mach/mach.h b/mach/mach.h
index ea39fb45fe..77b31397f7 100644
--- a/mach/mach.h
+++ b/mach/mach.h
@@ -1,5 +1,5 @@
 /* Standard header for all Mach programs.
-Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+Copyright (C) 1993, 1994, 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
@@ -71,6 +71,14 @@ mach_msg_server_timeout (boolean_t (*__demux) (mach_msg_header_t *__request,
 			 mach_msg_timeout_t __timeout);
 
 
+/* Deallocate all port rights and out-of-line memory in MSG. */
+extern void
+__mach_msg_destroy (mach_msg_header_t *msg),
+mach_msg_destroy (mach_msg_header_t *msg);
+
+/* XXX should be in mach/message.h. */
+extern typeof (mach_msg) __mach_msg;
+
 #define __need_FILE
 #include <stdio.h>
 
diff --git a/mach/msg-destroy.c b/mach/msg-destroy.c
index c0841f1190..585b9e2a54 100644
--- a/mach/msg-destroy.c
+++ b/mach/msg-destroy.c
@@ -26,6 +26,17 @@
 /*
  * HISTORY
  * $Log$
+ * Revision 1.4  1996/11/15 19:44:43  thomas
+ * Tue Nov 12 16:58:41 1996  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>
+ *
+ * 	* mach/mach.h (__mach_msg_destroy, mach_msg_destroy, __mach_msg):
+ *  	Provide prototypes.
+ *
+ * 	* mach/msg-destroy.c (mach_msg_destroy_port,
+ * 	mach_msg_destroy_memory): Use prototype	syntax.
+ * 	* hurd/hurdmalloc.c (more_memory, malloc_fork_prepare,
+ * 	malloc_fork_parent, malloc_fork_child): Likewise.
+ *
  * Revision 1.3  1995/01/23 22:16:52  roland
  * (mach_msg_destroy): Define as weak alias for __mach_msg_destroy.
  *
@@ -53,8 +64,8 @@
 #include <mach_init.h>
 #endif
 
-static void mach_msg_destroy_port();
-static void mach_msg_destroy_memory();
+static void mach_msg_destroy_port(mach_port_t, mach_msg_type_name_t);
+static void mach_msg_destroy_memory(vm_offset_t, vm_size_t);
 
 /*
  *	Routine:	mach_msg_destroy
diff --git a/manual/errno.texi b/manual/errno.texi
index 8f752b39ec..f96c260c28 100644
--- a/manual/errno.texi
+++ b/manual/errno.texi
@@ -894,25 +894,80 @@ Go home and have a glass of warm, dairy-fresh milk.
 This error code has no purpose.
 @end deftypevr
 
-@emph{The following error codes are defined by the Linux/i386 kernel.
-They are not yet documented.}
+@comment errno.h
+@comment XOPEN: Bad message
+@deftypevr Macro int EBADMSG
+@comment errno 107
+@end deftypevr
 
 @comment errno.h
-@comment Linux???: Interrupted system call should be restarted
-@deftypevr Macro int ERESTART
-@comment errno ???/85
+@comment XOPEN: Identifier removed
+@deftypevr Macro int EIDRM
+@comment errno 108
+@end deftypevr
+
+@comment errno.h
+@comment XOPEN: Multihop attempted
+@deftypevr Macro int EMULTIHOP
+@comment errno 109
+@end deftypevr
+
+@comment errno.h
+@comment XOPEN: No data available
+@deftypevr Macro int ENODATA
+@comment errno 110
 @end deftypevr
 
 @comment errno.h
-@comment Linux???: No message of desired type
+@comment XOPEN: Link has been severed
+@deftypevr Macro int ENOLINK
+@comment errno 111
+@end deftypevr
+
+@comment errno.h
+@comment XOPEN: No message of desired type
 @deftypevr Macro int ENOMSG
-@comment errno ???/42
+@comment errno 112
 @end deftypevr
 
 @comment errno.h
-@comment Linux???: Identifier removed
-@deftypevr Macro int EIDRM
-@comment errno ???/43
+@comment XOPEN: Out of streams resources
+@deftypevr Macro int ENOSR
+@comment errno 113
+@end deftypevr
+
+@comment errno.h
+@comment XOPEN: Device not a stream
+@deftypevr Macro int ENOSTR
+@comment errno 114
+@end deftypevr
+
+@comment errno.h
+@comment XOPEN: Value too large for defined data type
+@deftypevr Macro int EOVERFLOW
+@comment errno 115
+@end deftypevr
+
+@comment errno.h
+@comment XOPEN: Protocol error
+@deftypevr Macro int EPROTO
+@comment errno 116
+@end deftypevr
+
+@comment errno.h
+@comment XOPEN: Timer expired
+@deftypevr Macro int ETIME
+@comment errno 117
+@end deftypevr
+
+
+@emph{The following error codes are defined by the Linux/i386 kernel.
+They are not yet documented.}
+
+@comment errno.h
+@comment Linux???: Interrupted system call should be restarted
+@deftypevr Macro int ERESTART
+@comment errno ???/85
 @end deftypevr
 
 @comment errno.h
@@ -1012,30 +1067,6 @@ They are not yet documented.}
 @end deftypevr
 
 @comment errno.h
-@comment Linux???: Device not a stream
-@deftypevr Macro int ENOSTR
-@comment errno ???/60
-@end deftypevr
-
-@comment errno.h
-@comment Linux???: No data available
-@deftypevr Macro int ENODATA
-@comment errno ???/61
-@end deftypevr
-
-@comment errno.h
-@comment Linux???: Timer expired
-@deftypevr Macro int ETIME
-@comment errno ???/62
-@end deftypevr
-
-@comment errno.h
-@comment Linux???: Out of streams resources
-@deftypevr Macro int ENOSR
-@comment errno ???/63
-@end deftypevr
-
-@comment errno.h
 @comment Linux???: Machine is not on the network
 @deftypevr Macro int ENONET
 @comment errno ???/64
@@ -1048,12 +1079,6 @@ They are not yet documented.}
 @end deftypevr
 
 @comment errno.h
-@comment Linux???: Link has been severed
-@deftypevr Macro int ENOLINK
-@comment errno ???/67
-@end deftypevr
-
-@comment errno.h
 @comment Linux???: Advertise error
 @deftypevr Macro int EADV
 @comment errno ???/68
@@ -1072,36 +1097,12 @@ They are not yet documented.}
 @end deftypevr
 
 @comment errno.h
-@comment Linux???: Protocol error
-@deftypevr Macro int EPROTO
-@comment errno ???/71
-@end deftypevr
-
-@comment errno.h
-@comment Linux???: Multihop attempted
-@deftypevr Macro int EMULTIHOP
-@comment errno ???/72
-@end deftypevr
-
-@comment errno.h
 @comment Linux???: RFS specific error
 @deftypevr Macro int EDOTDOT
 @comment errno ???/73
 @end deftypevr
 
 @comment errno.h
-@comment Linux???: Not a data message
-@deftypevr Macro int EBADMSG
-@comment errno ???/74
-@end deftypevr
-
-@comment errno.h
-@comment Linux???: Value too large for defined data type
-@deftypevr Macro int EOVERFLOW
-@comment errno ???/75
-@end deftypevr
-
-@comment errno.h
 @comment Linux???: Name not unique on network
 @deftypevr Macro int ENOTUNIQ
 @comment errno ???/76
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index 70d8bf0b18..7985602443 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -96,7 +96,7 @@
 # define ungetc(c, s)	(--read_in, ungetc (c, s))
 # define inchar()	((c = getc (s)), (void) ++read_in, c)
 # define encode_error()	do {						      \
-			  _IO_funlockfile (s);				      \
+			  funlockfile (s);				      \
 			  __set_errno (EILSEQ);				      \
 			  return done;					      \
 			} while (0)
diff --git a/stdio/fopen.c b/stdio/fopen.c
index fea227482f..fa50f6af98 100644
--- a/stdio/fopen.c
+++ b/stdio/fopen.c
@@ -27,9 +27,7 @@ Cambridge, MA 02139, USA.  */
 
 /* Dissect the given mode string into an __io_mode.  */
 int
-__getmode (mode, mptr)
-     const char *mode;
-     __io_mode *mptr;
+__getmode (const char *mode, __io_mode *mptr)
 {
   register unsigned char i;
 
diff --git a/stdio/internals.c b/stdio/internals.c
index 8c2acc4026..8ec731fa62 100644
--- a/stdio/internals.c
+++ b/stdio/internals.c
@@ -24,8 +24,7 @@ Cambridge, MA 02139, USA.  */
 
 /* Make sure that FP has its functions set.  */
 void
-__stdio_check_funcs (fp)
-     register FILE *fp;
+__stdio_check_funcs (register FILE *fp)
 {
   if (!fp->__seen)
     {
@@ -51,8 +50,7 @@ __stdio_check_funcs (fp)
 /* Figure out what kind of buffering (none, line, or full)
    and what buffer size to give FP.  */
 static void
-init_stream (fp)
-     register FILE *fp;
+init_stream (register FILE *fp)
 {
   __stdio_check_funcs (fp);
 
@@ -141,8 +139,7 @@ __stdio_check_offset (stream)
    seeking as necessary and updating its `offset' field.
    Sets ferror(FP) (and possibly errno) for errors.  */
 static void
-seek_to_target (fp)
-     FILE *fp;
+seek_to_target (FILE *fp)
 {
   int save = errno;
   if (__stdio_check_offset (fp) == EOF)
@@ -197,9 +194,7 @@ seek_to_target (fp)
    flushed to avoid a system call for a single character.
    This is the default `output room' function.  */
 static void
-flushbuf (fp, c)
-     register FILE *fp;
-     int c;
+flushbuf (register FILE *fp, int c)
 {
   int flush_only = c == EOF;
   size_t buffer_written;
@@ -394,8 +389,7 @@ flushbuf (fp, c)
 /* Fill the buffer for FP and return the first character read (or EOF).
    This is the default `input_room' function.  */
 static int
-fillbuf (fp)
-     register FILE *fp;
+fillbuf (register FILE *fp)
 {
   /* How far into the buffer we read we want to start bufp.  */
   size_t buffer_offset = 0;
diff --git a/stdio/memstream.c b/stdio/memstream.c
index ab285f4624..304cc4ca85 100644
--- a/stdio/memstream.c
+++ b/stdio/memstream.c
@@ -29,9 +29,7 @@ struct memstream_info
 
 /* Enlarge STREAM's buffer.  */
 static void
-enlarge_buffer (stream, c)
-     register FILE *stream;
-     int c;
+enlarge_buffer (register FILE *stream, int c)
 {
   struct memstream_info *info = (struct memstream_info *) stream->__cookie;
   size_t need;
@@ -96,10 +94,7 @@ enlarge_buffer (stream, c)
    There is no external state to munge.  */
 
 static int
-seek (cookie, pos, whence)
-     void *cookie;
-     fpos_t *pos;
-     int whence;
+seek (void *cookie, fpos_t *pos, int whence)
 {
   switch (whence)
     {
@@ -120,8 +115,7 @@ seek (cookie, pos, whence)
 }
 
 static int
-free_info (cookie)
-     void *cookie;
+free_info (void *cookie)
 {
 #if 0
   struct memstream_info *info = (struct memstream_info *) cookie;
diff --git a/stdio/stdio.h b/stdio/stdio.h
index 083caa405e..bf4f7b818c 100644
--- a/stdio/stdio.h
+++ b/stdio/stdio.h
@@ -302,7 +302,7 @@ extern char *tmpnam_r __P ((char *__s));
 #endif
 
 
-#if def(__USE_SVID) || defined(__USE_XOPEN)
+#if defined(__USE_SVID) || defined(__USE_XOPEN)
 /* Generate a unique temporary filename using up to five characters of PFX
    if it is not NULL.  The directory to put this file in is searched for
    as follows: First the environment variable "TMPDIR" is checked.
diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
index 331362370b..f898e9a669 100644
--- a/sysdeps/mach/hurd/i386/init-first.c
+++ b/sysdeps/mach/hurd/i386/init-first.c
@@ -256,7 +256,7 @@ __libc_init_first (int argc __attribute__ ((unused)), ...)
    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/mach/hurd/ioctl.c b/sysdeps/mach/hurd/ioctl.c
index 24bfbed943..c10ba92e2c 100644
--- a/sysdeps/mach/hurd/ioctl.c
+++ b/sysdeps/mach/hurd/ioctl.c
@@ -27,7 +27,7 @@ Cambridge, MA 02139, USA.  */
 #include <assert.h>
 #include <string.h>
 #include <hurd/ioctl.h>
-
+#include <mach/mig_support.h>
 
 #define typesize(type)	(1 << (type))
 
diff --git a/sysdeps/mach/hurd/lchown.c b/sysdeps/mach/hurd/lchown.c
new file mode 100644
index 0000000000..72d525571c
--- /dev/null
+++ b/sysdeps/mach/hurd/lchown.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 1991, 1992, 1994, 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
+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 <stddef.h>
+#include <unistd.h>
+#include <hurd.h>
+#include <fcntl.h>
+
+/* Change the owner and group of FILE; if it's a link, do the link and
+   not the target.  */
+int
+__lchown (file, owner, group)
+     const char *file;
+     uid_t owner;
+     gid_t group;
+{
+  error_t err;
+  file_t port = __file_name_lookup (file, O_NOLINK, 0);
+  if (port == MACH_PORT_NULL)
+    return -1;
+  err = __file_chown (port, owner, group);
+  __mach_port_deallocate (__mach_task_self (), port);
+  if (err)
+    return __hurd_fail (err);
+  return 0;
+}
+
+weak_alias (__lchown, lchown)
diff --git a/sysdeps/mach/hurd/select.c b/sysdeps/mach/hurd/select.c
index 60bb489612..aa99944e84 100644
--- a/sysdeps/mach/hurd/select.c
+++ b/sysdeps/mach/hurd/select.c
@@ -117,67 +117,76 @@ DEFUN(__select, (nfds, readfds, writefds, exceptfds, timeout),
     return -1;
 
   /* Send them all io_select request messages.  */
-  err = 0;
-  got = 0;
-  portset = MACH_PORT_NULL;
-  for (i = firstfd; i <= lastfd; ++i)
-    if (d[i].type)
-      {
-	int type = d[i].type;
-	d[i].reply_port = __mach_reply_port ();
-	err = __io_select (d[i].io_port, d[i].reply_port,
-			   /* Poll only when there's a single descriptor.  */
-			   (firstfd == lastfd) ? to : 0,
-			   &type);
-	switch (err)
+		     
+  if (firstfd == -1)
+    /* But not if there were no ports to deal with at all. */
+    portset = __mach_reply_port ();
+  else
+    {
+      err = 0;
+      got = 0;
+      portset = MACH_PORT_NULL;
+      
+      for (i = firstfd; i <= lastfd; ++i)
+	if (d[i].type)
 	  {
-	  case MACH_RCV_TIMED_OUT:
-	    /* No immediate response.  This is normal.  */
-	    err = 0;
-	    if (firstfd == lastfd)
-	      /* When there's a single descriptor, we don't need a portset,
-		 so just pretend we have one, but really use the single reply
-		 port.  */
-	      portset = d[i].reply_port;
-	    else if (got == 0)
-	      /* We've got multiple reply ports, so we need a port set to
-		 multiplex them.  */
+	    int type = d[i].type;
+	    d[i].reply_port = __mach_reply_port ();
+	    err = __io_select (d[i].io_port, d[i].reply_port,
+			       /* Poll only if there's a single descriptor.  */
+			       (firstfd == lastfd) ? to : 0,
+			       &type);
+	    switch (err)
 	      {
-		/* We will wait again for a reply later.  */
-		if (portset == MACH_PORT_NULL)
-		  /* Create the portset to receive all the replies on.  */
-		  err = __mach_port_allocate (__mach_task_self (),
-					      MACH_PORT_RIGHT_PORT_SET,
-					      &portset);
-		if (! err)
-		  /* Put this reply port in the port set.  */
-		  __mach_port_move_member (__mach_task_self (),
-					   d[i].reply_port, portset);
+	      case MACH_RCV_TIMED_OUT:
+		/* No immediate response.  This is normal.  */
+		err = 0;
+		if (firstfd == lastfd)
+		  /* When there's a single descriptor, we don't need a
+		     portset, so just pretend we have one, but really
+		     use the single reply port.  */
+		  portset = d[i].reply_port;
+		else if (got == 0)
+		  /* We've got multiple reply ports, so we need a port set to
+		     multiplex them.  */
+		  {
+		    /* We will wait again for a reply later.  */
+		    if (portset == MACH_PORT_NULL)
+		      /* Create the portset to receive all the replies on.  */
+		      err = __mach_port_allocate (__mach_task_self (),
+						  MACH_PORT_RIGHT_PORT_SET,
+						  &portset);
+		    if (! err)
+		      /* Put this reply port in the port set.  */
+		      __mach_port_move_member (__mach_task_self (),
+					       d[i].reply_port, portset);
+		  }
+		break;
+
+	      default:
+		/* No other error should happen.  Callers of select
+		   don't expect to see errors, so we simulate
+		   readiness of the erring object and the next call
+		   hopefully will get the error again.  */
+		type = SELECT_ALL;
+		/* FALLTHROUGH */
+
+	      case 0:
+		/* We got an answer.  */
+		if ((type & SELECT_ALL) == 0)
+		  /* Bogus answer; treat like an error, as a fake positive.  */
+		  type = SELECT_ALL;
+		
+		/* This port is already ready already.  */
+		d[i].type &= type;
+		d[i].type |= SELECT_RETURNED;
+		++got;
+		break;
 	      }
-	    break;
-
-	  default:
-	    /* No other error should happen.  Callers of select don't
-	       expect to see errors, so we simulate readiness of the erring
-	       object and the next call hopefully will get the error again.  */
-	    type = SELECT_ALL;
-	    /* FALLTHROUGH */
-
-	  case 0:
-	    /* We got an answer.  */
-	    if ((type & SELECT_ALL) == 0)
-	      /* Bogus answer; treat like an error, as a fake positive.  */
-	      type = SELECT_ALL;
-
-	    /* This port is already ready already.  */
-	    d[i].type &= type;
-	    d[i].type |= SELECT_RETURNED;
-	    ++got;
-	    break;
+	    _hurd_port_free (&d[i].cell->port, &d[i].ulink, d[i].io_port);
 	  }
-	_hurd_port_free (&d[i].cell->port, &d[i].ulink, d[i].io_port);
-      }
-
+    }
+  
   /* Now wait for reply messages.  */
   if (!err && got == 0)
     {
@@ -234,7 +243,7 @@ DEFUN(__select, (nfds, readfds, writefds, exceptfds, timeout),
 		  (msg.success.result & SELECT_ALL) == 0)
 		{
 		  /* Error or bogus reply.  Simulate readiness.  */
-		  __mach_msg_destroy (&msg);
+		  __mach_msg_destroy (&msg.head);
 		  msg.success.result = SELECT_ALL;
 		}
 
@@ -242,13 +251,15 @@ DEFUN(__select, (nfds, readfds, writefds, exceptfds, timeout),
                  readiness.  */
 	      {
 		int had = got;
-		for (i = firstfd; i <= lastfd; ++i)
-		  if (d[i].type && d[i].reply_port == msg.head.msgh_local_port)
-		    {
-		      d[i].type &= msg.success.result;
-		      d[i].type |= SELECT_RETURNED;
-		      ++got;
-		    }
+		if (firstfd != -1)
+		  for (i = firstfd; i <= lastfd; ++i)
+		    if (d[i].type
+			&& d[i].reply_port == msg.head.msgh_local_port)
+		      {
+			d[i].type &= msg.success.result;
+			d[i].type |= SELECT_RETURNED;
+			++got;
+		      }
 		assert (got > had);
 	      }
 	    }
@@ -280,10 +291,11 @@ DEFUN(__select, (nfds, readfds, writefds, exceptfds, timeout),
 	err = 0;
     }
 
-  for (i = firstfd; i <= lastfd; ++i)
-    if (d[i].type)
-      __mach_port_destroy (__mach_task_self (), d[i].reply_port);
-  if (firstfd != lastfd && portset != MACH_PORT_NULL)
+  if (firstfd != -1)
+    for (i = firstfd; i <= lastfd; ++i)
+      if (d[i].type)
+	__mach_port_destroy (__mach_task_self (), d[i].reply_port);
+  if (firstfd == -1 || (firstfd != lastfd && portset != MACH_PORT_NULL))
     /* Destroy PORTSET, but only if it's not actually the reply port for a
        single descriptor (in which case it's destroyed in the previous loop;
        not doing it here is just a bit more efficient).  */
@@ -298,26 +310,27 @@ DEFUN(__select, (nfds, readfds, writefds, exceptfds, timeout),
 
   /* Set the user bitarrays.  We only ever have to clear bits, as all desired
      ones are initially set.  */
-  for (i = firstfd; i <= lastfd; ++i)
-    {
-      int type = d[i].type;
-
-      if ((type & SELECT_RETURNED) == 0)
-	type = 0;
-
-      if (type & SELECT_READ)
-	got++;
-      else if (readfds)
-	FD_CLR (i, readfds);
-      if (type & SELECT_WRITE)
-	got++;
-      else if (writefds)
-	FD_CLR (i, writefds);
-      if (type & SELECT_URG)
-	got++;
-      else if (exceptfds)
-	FD_CLR (i, exceptfds);
-    }
+  if (firstfd != -1)
+    for (i = firstfd; i <= lastfd; ++i)
+      {
+	int type = d[i].type;
+	
+	if ((type & SELECT_RETURNED) == 0)
+	  type = 0;
+
+	if (type & SELECT_READ)
+	  got++;
+	else if (readfds)
+	  FD_CLR (i, readfds);
+	if (type & SELECT_WRITE)
+	  got++;
+	else if (writefds)
+	  FD_CLR (i, writefds);
+	if (type & SELECT_URG)
+	  got++;
+	else if (exceptfds)
+	  FD_CLR (i, exceptfds);
+      }
 
   return got;
 }
diff --git a/sysdeps/mach/hurd/statbuf.h b/sysdeps/mach/hurd/statbuf.h
index c1d8e8f75c..a8f92cb5ed 100644
--- a/sysdeps/mach/hurd/statbuf.h
+++ b/sysdeps/mach/hurd/statbuf.h
@@ -106,8 +106,20 @@ struct stat
    protection bits for unknown users.  */
 #define S_IUNKSHIFT	12
 
-/* All the unused bits.  */
-#define	S_ISPARE	(~(S_IFMT|S_INOCACHE|S_IUNKNOWN|07777))
+/* Read only bits: */
+
+/* There is a passive translator set for this file */
+#define S_IPTRANS	000010000000
+/* There is an active translator running on this file */
+#define S_IATRANS	000020000000
+/* This is the root of a filesystem (or single node translator) */
+#define S_IROOT		000040000000
+/* All the bits relevant to translators */
+#define S_ITRANS	000070000000
+
+/* ALL the unused bits.  */
+#define	S_ISPARE	(~(S_IFMT|S_ITRANS|S_INOCACHE|    \
+			   S_IUSEUNK|S_IUNKNOWN|07777))
 #endif
 
 /* Default file creation mask (umask).  */
diff --git a/sysdeps/posix/readv.c b/sysdeps/posix/readv.c
index 5f61e61b9f..116784eeab 100644
--- a/sysdeps/posix/readv.c
+++ b/sysdeps/posix/readv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 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
@@ -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 <stdlib.h>
 #include <unistd.h>
 #include <string.h>
@@ -27,9 +26,11 @@ Cambridge, MA 02139, USA.  */
    The buffers are filled in the order specified.
    Operates just like `read' (see <unistd.h>) except that data are
    put in VECTOR instead of a contiguous buffer.  */
-int
-DEFUN(readv, (fd, vector, count),
-      int fd AND CONST struct iovec *vector AND size_t count)
+ssize_t
+readv (fd, vector, count)
+     int fd;
+     const struct iovec *vector;
+     size_t count;
 {
   char *buffer;
   size_t bytes;
diff --git a/sysdeps/posix/writev.c b/sysdeps/posix/writev.c
index 56e29a64b9..75a41d33b9 100644
--- a/sysdeps/posix/writev.c
+++ b/sysdeps/posix/writev.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 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
@@ -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 <stdlib.h>
 #include <unistd.h>
 #include <string.h>
@@ -27,9 +26,11 @@ Cambridge, MA 02139, USA.  */
    The data is written in the order specified.
    Operates just like `write' (see <unistd.h>) except that the data
    are taken from VECTOR instead of a contiguous buffer.  */
-int
-DEFUN(writev, (fd, vector, count),
-      int fd AND CONST struct iovec *vector AND size_t count)
+ssize_t
+writev (fd, vector, count)
+     int fd;
+     const struct iovec *vector;
+     size_t count;
 {
   char *buffer;
   register char *bp;