* sysdeps/posix/readv.c (readv): Change return type to ssize_t.
Deansideclized.
* sysdeps/posix/writev.c (writev): Likewise.
/*
* 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.
}
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;
}
#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.
}
}
-static void malloc_fork_parent()
+static void
+malloc_fork_parent(void)
/*
* Called in the parent process after a fork() to resume normal operation.
*/
}
}
-static void malloc_fork_child()
+static void
+malloc_fork_child(void)
/*
* Called in the child process after a fork() to resume normal operation.
*/
/* 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
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>
/*
* 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.
*
#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
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
@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
@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
@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
# 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)
/* 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;
/* 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)
{
/* 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);
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)
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;
/* 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;
/* 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;
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)
{
}
static int
-free_info (cookie)
- void *cookie;
+free_info (void *cookie)
{
#if 0
struct memstream_info *info = (struct memstream_info *) cookie;
#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.
cause ld.so to gain an init function, which is not a cool thing. */
void
-_dl_start ()
+_dl_start (void)
{
abort ();
}
#include <assert.h>
#include <string.h>
#include <hurd/ioctl.h>
-
+#include <mach/mig_support.h>
#define typesize(type) (1 << (type))
--- /dev/null
+/* 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)
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)
{
(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;
}
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);
}
}
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). */
/* 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;
}
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). */
-/* 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
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>
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;
-/* 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
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>
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;