1995-05-11 01:02:23 +00:00
|
|
|
|
/* Operating system support for run-time dynamic linker. Hurd version.
|
1997-01-21 06:10:42 +00:00
|
|
|
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
1996-12-20 01:39:50 +00:00
|
|
|
|
This file is part of the GNU C Library.
|
1995-05-11 01:02:23 +00:00
|
|
|
|
|
1996-12-20 01:39:50 +00:00
|
|
|
|
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.
|
1995-05-11 01:02:23 +00:00
|
|
|
|
|
1996-12-20 01:39:50 +00:00
|
|
|
|
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.
|
1995-05-11 01:02:23 +00:00
|
|
|
|
|
1996-12-20 01:39:50 +00:00
|
|
|
|
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. */
|
1995-05-11 01:02:23 +00:00
|
|
|
|
|
|
|
|
|
#include <hurd.h>
|
|
|
|
|
#include <link.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <sys/mman.h>
|
|
|
|
|
#include <sys/wait.h>
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <sysdep.h>
|
|
|
|
|
#include <mach/mig_support.h>
|
|
|
|
|
#include "hurdstartup.h"
|
|
|
|
|
#include <mach/host_info.h>
|
1995-11-16 00:44:18 +00:00
|
|
|
|
#include "../stdio-common/_itoa.h"
|
1995-05-11 01:02:23 +00:00
|
|
|
|
#include <hurd/auth.h>
|
|
|
|
|
#include <hurd/term.h>
|
|
|
|
|
#include <stdarg.h>
|
1996-05-04 13:57:05 +00:00
|
|
|
|
#include <ctype.h>
|
1996-07-30 19:23:06 +00:00
|
|
|
|
#include <sys/stat.h>
|
1995-05-11 01:02:23 +00:00
|
|
|
|
|
|
|
|
|
#include "dl-machine.h"
|
|
|
|
|
|
1995-05-31 13:23:14 +00:00
|
|
|
|
extern void __mach_init (void);
|
|
|
|
|
|
1995-05-11 01:02:23 +00:00
|
|
|
|
extern int _dl_argc;
|
|
|
|
|
extern char **_dl_argv;
|
|
|
|
|
extern char **_environ;
|
|
|
|
|
|
1996-07-29 03:49:00 +00:00
|
|
|
|
int __libc_enable_secure;
|
|
|
|
|
|
1995-05-11 01:02:23 +00:00
|
|
|
|
struct hurd_startup_data *_dl_hurd_data;
|
|
|
|
|
|
1995-06-08 09:00:23 +00:00
|
|
|
|
unsigned int __hurd_threadvar_max = _HURD_THREADVAR_MAX;
|
|
|
|
|
static unsigned long int threadvars[_HURD_THREADVAR_MAX];
|
|
|
|
|
unsigned long int __hurd_threadvar_stack_offset
|
|
|
|
|
= (unsigned long int) &threadvars;
|
1996-02-08 02:10:15 +00:00
|
|
|
|
unsigned long int __hurd_threadvar_stack_mask;
|
1995-06-08 09:00:23 +00:00
|
|
|
|
|
|
|
|
|
/* XXX loser kludge for vm_map kernel bug */
|
|
|
|
|
static vm_address_t fmha;
|
|
|
|
|
static vm_size_t fmhs;
|
1996-02-08 02:10:15 +00:00
|
|
|
|
static void unfmh(void){
|
1995-06-08 09:00:23 +00:00
|
|
|
|
__vm_deallocate(__mach_task_self(),fmha,fmhs);}
|
1996-02-08 02:10:15 +00:00
|
|
|
|
static void fmh(void) {
|
1995-06-08 09:00:23 +00:00
|
|
|
|
error_t err;int x;mach_port_t p;
|
|
|
|
|
vm_address_t a=0x08000000U,max=VM_MAX_ADDRESS;
|
|
|
|
|
while (!(err=__vm_region(__mach_task_self(),&a,&fmhs,&x,&x,&x,&x,&p,&x))){
|
|
|
|
|
__mach_port_deallocate(__mach_task_self(),p);
|
|
|
|
|
if (a+fmhs>=0x80000000U){
|
1995-07-10 09:40:15 +00:00
|
|
|
|
max=a; break;}
|
1995-06-08 09:00:23 +00:00
|
|
|
|
fmha=a+=fmhs;}
|
|
|
|
|
if (err) assert(err==KERN_NO_SPACE);
|
1995-07-10 09:40:15 +00:00
|
|
|
|
if (!fmha)fmhs=0;else{
|
1995-06-08 09:00:23 +00:00
|
|
|
|
fmhs=max-fmha;
|
|
|
|
|
err = __vm_map (__mach_task_self (),
|
|
|
|
|
&fmha, fmhs, 0, 0, MACH_PORT_NULL, 0, 1,
|
|
|
|
|
VM_PROT_NONE, VM_PROT_NONE, VM_INHERIT_COPY);
|
1995-07-10 09:40:15 +00:00
|
|
|
|
assert_perror(err);}
|
1995-06-08 09:00:23 +00:00
|
|
|
|
}
|
|
|
|
|
/* XXX loser kludge for vm_map kernel bug */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1995-05-11 01:02:23 +00:00
|
|
|
|
Elf32_Addr
|
|
|
|
|
_dl_sysdep_start (void **start_argptr,
|
|
|
|
|
void (*dl_main) (const Elf32_Phdr *phdr, Elf32_Word phent,
|
|
|
|
|
Elf32_Addr *user_entry))
|
|
|
|
|
{
|
1995-09-30 21:18:30 +00:00
|
|
|
|
extern void _start ();
|
|
|
|
|
|
1995-05-11 01:02:23 +00:00
|
|
|
|
void go (int *argdata)
|
|
|
|
|
{
|
1995-09-30 21:18:30 +00:00
|
|
|
|
extern unsigned int _dl_skip_args; /* rtld.c */
|
1995-05-11 01:02:23 +00:00
|
|
|
|
char **p;
|
|
|
|
|
|
|
|
|
|
/* Cache the information in various global variables. */
|
1995-05-31 13:23:14 +00:00
|
|
|
|
_dl_argc = *argdata;
|
1995-09-30 21:18:30 +00:00
|
|
|
|
_dl_argv = 1 + (char **) argdata;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
_environ = &_dl_argv[_dl_argc + 1];
|
1995-09-30 21:18:30 +00:00
|
|
|
|
for (p = _environ; *p++;); /* Skip environ pointers and terminator. */
|
|
|
|
|
|
|
|
|
|
if ((void *) p == _dl_argv[0])
|
|
|
|
|
{
|
|
|
|
|
static struct hurd_startup_data nodata;
|
|
|
|
|
_dl_hurd_data = &nodata;
|
|
|
|
|
nodata.user_entry = (vm_address_t) &_start;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
_dl_hurd_data = (void *) p;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
|
1996-07-29 00:18:42 +00:00
|
|
|
|
__libc_enable_secure = _dl_hurd_data->flags & EXEC_SECURE;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
|
1995-11-16 00:44:18 +00:00
|
|
|
|
if (_dl_hurd_data->flags & EXEC_STACK_ARGS &&
|
|
|
|
|
_dl_hurd_data->user_entry == 0)
|
|
|
|
|
_dl_hurd_data->user_entry = (vm_address_t) &_start;
|
|
|
|
|
|
1995-06-08 09:00:23 +00:00
|
|
|
|
unfmh(); /* XXX */
|
1995-09-30 21:18:30 +00:00
|
|
|
|
|
|
|
|
|
if (_dl_hurd_data->user_entry == (vm_address_t) &_start)
|
|
|
|
|
/* We were invoked as a command, not as the program interpreter.
|
|
|
|
|
The generic ld.so code supports this: it will parse the args
|
|
|
|
|
as "ld.so PROGRAM [ARGS...]". For booting the Hurd, we
|
|
|
|
|
support an additional special syntax:
|
|
|
|
|
ld.so [-LIBS...] PROGRAM [ARGS...]
|
|
|
|
|
Each LIBS word consists of "FILENAME=MEMOBJ";
|
|
|
|
|
for example "-/lib/libc.so=123" says that the contents of
|
|
|
|
|
/lib/libc.so are found in a memory object whose port name
|
|
|
|
|
in our task is 123. */
|
1995-10-05 09:00:06 +00:00
|
|
|
|
while (_dl_argc > 2 && _dl_argv[1][0] == '-' && _dl_argv[1][1] != '-')
|
1995-09-30 21:18:30 +00:00
|
|
|
|
{
|
|
|
|
|
char *lastslash, *memobjname, *p;
|
|
|
|
|
struct link_map *l;
|
|
|
|
|
mach_port_t memobj;
|
|
|
|
|
error_t err;
|
|
|
|
|
|
|
|
|
|
++_dl_skip_args;
|
|
|
|
|
--_dl_argc;
|
|
|
|
|
p = _dl_argv++[1] + 1;
|
|
|
|
|
|
|
|
|
|
memobjname = strchr (p, '=');
|
|
|
|
|
if (! memobjname)
|
|
|
|
|
_dl_sysdep_fatal ("Bogus library spec: ", p, "\n", NULL);
|
|
|
|
|
*memobjname++ = '\0';
|
1996-05-04 13:57:05 +00:00
|
|
|
|
memobj = 0;
|
|
|
|
|
while (*memobjname != '\0')
|
|
|
|
|
memobj = (memobj * 10) + (*memobjname++ - '0');
|
1995-11-16 00:44:18 +00:00
|
|
|
|
|
1995-09-30 21:18:30 +00:00
|
|
|
|
/* Add a user reference on the memory object port, so we will
|
|
|
|
|
still have one after _dl_map_object_from_fd calls our
|
|
|
|
|
`close'. */
|
|
|
|
|
err = __mach_port_mod_refs (__mach_task_self (), memobj,
|
|
|
|
|
MACH_PORT_RIGHT_SEND, +1);
|
|
|
|
|
assert_perror (err);
|
1995-11-16 00:44:18 +00:00
|
|
|
|
|
1995-09-30 21:18:30 +00:00
|
|
|
|
lastslash = strrchr (p, '/');
|
|
|
|
|
l = _dl_map_object_from_fd (lastslash ? lastslash + 1 : p,
|
|
|
|
|
memobj, strdup (p));
|
|
|
|
|
|
|
|
|
|
/* Squirrel away the memory object port where it
|
|
|
|
|
can be retrieved by the program later. */
|
|
|
|
|
l->l_info[DT_NULL] = (void *) memobj;
|
|
|
|
|
}
|
|
|
|
|
|
1995-05-11 01:02:23 +00:00
|
|
|
|
/* Call elf/rtld.c's main program. It will set everything
|
|
|
|
|
up and leave us to transfer control to USER_ENTRY. */
|
|
|
|
|
(*dl_main) ((const Elf32_Phdr *) _dl_hurd_data->phdr,
|
|
|
|
|
_dl_hurd_data->phdrsz / sizeof (Elf32_Phdr),
|
|
|
|
|
&_dl_hurd_data->user_entry);
|
|
|
|
|
|
1995-09-30 21:18:30 +00:00
|
|
|
|
if (_dl_skip_args && _dl_argv[-_dl_skip_args] == (char *) p)
|
|
|
|
|
{
|
|
|
|
|
/* We are ignoring the first few arguments, but we have no Hurd
|
|
|
|
|
startup data. It is magical convention that ARGV[0] == P in
|
|
|
|
|
this case. The startup code in init-first.c will get confused
|
|
|
|
|
if this is not the case, so we must rearrange things to make
|
|
|
|
|
it so. Overwrite the original ARGV[0] at P with
|
|
|
|
|
ARGV[_dl_skip_args]. */
|
|
|
|
|
assert ((char *) p < _dl_argv[0]);
|
|
|
|
|
_dl_argv[0] = strcpy ((char *) p, _dl_argv[0]);
|
|
|
|
|
}
|
|
|
|
|
|
1995-05-11 01:02:23 +00:00
|
|
|
|
{
|
|
|
|
|
extern void _dl_start_user (void);
|
|
|
|
|
/* Unwind the stack to ARGDATA and simulate a return from _dl_start
|
|
|
|
|
to the RTLD_START code which will run the user's entry point. */
|
|
|
|
|
RETURN_TO (argdata, &_dl_start_user, _dl_hurd_data->user_entry);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1995-05-31 13:23:14 +00:00
|
|
|
|
/* Set up so we can do RPCs. */
|
|
|
|
|
__mach_init ();
|
|
|
|
|
|
1995-06-08 09:00:23 +00:00
|
|
|
|
fmh(); /* XXX */
|
|
|
|
|
|
1995-05-11 01:02:23 +00:00
|
|
|
|
/* See hurd/hurdstartup.c; this deals with getting information
|
|
|
|
|
from the exec server and slicing up the arguments.
|
|
|
|
|
Then it will call `go', above. */
|
|
|
|
|
_hurd_startup (start_argptr, &go);
|
|
|
|
|
|
|
|
|
|
LOSE;
|
1995-08-14 22:49:23 +00:00
|
|
|
|
abort ();
|
1995-05-11 01:02:23 +00:00
|
|
|
|
}
|
1995-11-17 02:33:47 +00:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_dl_sysdep_start_cleanup (void)
|
|
|
|
|
{
|
|
|
|
|
/* Deallocate the reply port and task port rights acquired by
|
|
|
|
|
__mach_init. We are done with them now, and the user will
|
|
|
|
|
reacquire them for himself when he wants them. */
|
|
|
|
|
__mig_dealloc_reply_port (MACH_PORT_NULL);
|
|
|
|
|
__mach_port_deallocate (__mach_task_self (), __mach_task_self_);
|
|
|
|
|
}
|
1995-05-11 01:02:23 +00:00
|
|
|
|
|
Update.
1997-05-24 03:51 Ulrich Drepper <drepper@cygnus.com>
* stdlib/Makefile (routines): Add strtol_l, strtoul_l, strtoll_l,
strtoull_l, strtof_l, strtod_l, and strtold_l.
* stdlib/stdlib.h: Add prototypes for new functions.
* stdlib/strtod.c: Change for compiling as strtoX_l.
* stdlib/strtol.c: Likewise.
* stdlib/strtof.c: Likewise.
* stdlib/strtold.c: Likewise.
* stdlib/strtod_l.c: New file.
* stdlib/strtof_l.c: New file.
* stdlib/strtold_l.c: New file.
* stdlib/strtol_l.c: New file.
* stdlib/strtoul_l.c: New file.
* stdlib/strtoll_l.c: New file.
* stdlib/strtoull_l.c: New file.
* string/Makefile (routines): Add strcasecmp_l and strncase_l.
* string/string.h: Add prototypes for new functions.
* sysdeps/generic/strcasecmp.c: Change for compiling as strcasecmp_l.
* sysdeps/generic/strncase.c: Change for compiling as strncasecmp_l.
* sysdeps/generic/strcasecmp_l.c: New file.
* sysdeps/generic/strncase_l.c: New file.
* wcsmbs/Makefile (routines): Add wcstol_l, wcstoul_l, wcstoll_l,
wcstoull_l, wcstod_l, wcstold_l, wcstof_l, wcscasecmp_l, and
wcsncase_l.
* wcsmbs/wchar.h: Add prototypes for new functions.
* wcsmbs/wcscasecmp.c: Change for compiling as wcscasecmp_l.
* wcsmbs/wcsncase.c: Change for compiling as wcsncasecmp_l.
* wcsmbs/wcscasecmp_l.c: New file.
* wcsmbs/wcsncase_l.c: New file.
* wcsmbs/wcstof.c: Change for compiling as wcstof_l.c
* wcsmbs/wcstold.c: Change for compiling as wcstold_l.c
* wcsmcs/wcstod_l.c: New file.
* wcsmcs/wcstof_l.c: New file.
* wcsmcs/wcstold_l.c: New file.
* wcsmcs/wcstol_l.c: New file.
* wcsmcs/wcstoul_l.c: New file.
* wcsmcs/wcstoll_l.c: New file.
* wcsmcs/wcstoull_l.c: New file.
* Makeconfig (binfmt-subdir): New variable. Set to `elf' if
$(elf) is defined. More to come later when other binary formats
are supported.
* Makefile (subdirs): Remove elf. Add $(binfmt-subdir).
Suggested by Philip Blundell.
* stdlib/Makefile (headers): Add fmtmsg.h.
(routines): Add fmtmsg.
* stdlib/fmtmsg.c: New file.
* stdlib/fmtmsg.h: New file.
* manual/stdio.texi: Add description of fmtmsg and addseverity.
* manual/examples/fmtmsgexpl.c: Example program for fmtmsg
documentation.
1997-05-23 15:26 Philip Blundell <pjb27@cam.ac.uk>
* resolv/res_query.c (res_querydomain): Avoid potential buffer
overrun. Reported by Dan A. Dickey <ddickey@transition.com>.
1997-05-22 18:36 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* elf/dl-support.c (_dl_sysdep_open_zero_fill,
_dl_sysdep_read_whole_file): Moved functions to ...
* elf/dl-misc.c: This new file.
* sysdeps/generic/dl-sysdepio.c: Delete file and move functions...
* elf/dl-misc.c: ... here.
* sysdeps/generic/dl-sysdep.c (_dl_sysdep_open_zero_fill,
_dl_sysdep_read_whole_file): Delete functions; they now come from
elf/dl-misc.c (dl-support.c had contained identical versions).
* sysdeps/mach/hurd/dl-sysdepio.c: Delete file; move functions...
* sysdeps/mach/hurd/dl-sysdep.c: ... here, but mark them weak so
that the regular ones in dl-misc work once we've initialized.
* elf/Makefile (dl-routines): Remove dl-sysdepio.c. Add dl-misc.c.
1997-05-22 21:55 Philip Blundell <pjb27@cam.ac.uk>
* inet/Makefile (headers): Add netinet/inbits.h.
* inet/netinet/in.h: New file.
* sysdeps/generic/netinet/inbits.h: Likewise.
* sysdeps/unix/sysv/linux/netinet/inbits.h: Likewise.
* sysdeps/generic/netinet/ip6.h: Move to...
* inet/netinet/ip6.h: ... here.
* sysdeps/generic/netinet/icmp6.h: Move to...
* inet/netinet/icmp6.h: ... here.
* sysdeps/unix/sysv/linux/netinet/in.h: Remove.
* sysdeps/generic/netinet/in.h: Remove.
1997-05-22 05:40 Richard Henderson <rth@tamu.edu>
* sysdeps/alpha/dl-machine.h (elf_machine_runtime_setup): If we are
not looking at the new thread-safe .plt, don't be lazy about relocs.
(_dl_runtime_resolve): Fix up arithmetic for new .plt layout.
(elf_alpha_fix_plt): Insert wmb as appropriate to ensure safety.
* elf/dynamic-link.h (ELF_DYNAMIC_RELOCATE): Let
elf_machine_runtime_setup() decide if we can actually be lazy.
* elf/rtld.c (_dl_start): So don't call it.
* elf/dl-reloc.c (_dl_relocate_object): Likewise.
* sysdeps/i386/dl-machine.h (elf_machine_runtime_setup): Return lazy.
* sysdeps/m68k/dl-machine.h (elf_machine_runtime_setup): Likewise.
* sysdeps/mips/dl-machine.h (elf_machine_runtime_setup): Likewise.
* sysdeps/powerpc/dl-machine.h (elf_machine_runtime_setup): Likewise.
* sysdeps/sparc/dl-machine.h (elf_machine_runtime_setup): Likewise.
* sysdeps/stub/dl-machine.h (elf_machine_runtime_setup): Update
skeleton definition.
1997-05-22 18:45 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/i386/fpu/__math.h (logb): Remove second value placed on
stack by fxtract.
1997-05-22 13:07 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sunrpc/rpcsvc/rusers.x: Provide and correct prototypes,
add cast to (xdrproc_t) where necessary to prevent warnings.
1997-05-22 12:18 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c: Remove I/O functions.
* sunrpc/rpcinfo.c (get_inet_address): Use INADDR_NONE and INADDR_ANY
* sysdeps/libm-ieee754/s_cexp.c: Fix typo: string_alias ->
* nss/XXX-lookup.c: Add missing explanation.
1997-05-24 02:30:09 +00:00
|
|
|
|
void
|
|
|
|
|
_dl_sysdep_fatal (const char *msg, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
|
|
va_start (ap, msg);
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
size_t len = strlen (msg);
|
|
|
|
|
mach_msg_type_number_t nwrote;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (__io_write (_hurd_init_dtable[2], msg, len, -1, &nwrote))
|
|
|
|
|
break;
|
|
|
|
|
len -= nwrote;
|
|
|
|
|
msg += nwrote;
|
|
|
|
|
} while (nwrote > 0);
|
|
|
|
|
msg = va_arg (ap, const char *);
|
|
|
|
|
} while (msg);
|
|
|
|
|
va_end (ap);
|
|
|
|
|
|
|
|
|
|
_exit (127);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_dl_sysdep_error (const char *msg, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
|
|
va_start (ap, msg);
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
size_t len = strlen (msg);
|
|
|
|
|
mach_msg_type_number_t nwrote;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (__io_write (_hurd_init_dtable[2], msg, len, -1, &nwrote))
|
|
|
|
|
break;
|
|
|
|
|
len -= nwrote;
|
|
|
|
|
msg += nwrote;
|
|
|
|
|
} while (nwrote > 0);
|
|
|
|
|
msg = va_arg (ap, const char *);
|
|
|
|
|
} while (msg);
|
|
|
|
|
va_end (ap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_dl_sysdep_message (const char *msg, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
|
|
va_start (ap, msg);
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
size_t len = strlen (msg);
|
|
|
|
|
mach_msg_type_number_t nwrote;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (__io_write (_hurd_init_dtable[1], msg, len, -1, &nwrote))
|
|
|
|
|
break;
|
|
|
|
|
len -= nwrote;
|
|
|
|
|
msg += nwrote;
|
|
|
|
|
} while (nwrote > 0);
|
|
|
|
|
msg = va_arg (ap, const char *);
|
|
|
|
|
} while (msg);
|
|
|
|
|
va_end (ap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Minimal open/close/mmap implementation sufficient for initial loading of
|
|
|
|
|
shared libraries. These are weak definitions so that when the
|
|
|
|
|
dynamic linker re-relocates itself to be user-visible (for -ldl),
|
1995-05-11 01:02:23 +00:00
|
|
|
|
/* Minimal open/close/mmap implementation sufficient for initial loading of
|
|
|
|
|
shared libraries. These are weak definitions so that when the
|
|
|
|
|
dynamic linker re-relocates itself to be user-visible (for -ldl),
|
|
|
|
|
it will get the user's definition (i.e. usually libc's). */
|
|
|
|
|
|
1996-12-20 01:39:50 +00:00
|
|
|
|
/* Open FILE_NAME and return a read-mmappable port in MEMOBJ_RD for it, or
|
1996-07-30 19:23:06 +00:00
|
|
|
|
return an error. If STAT is non-zero, stat the file into that stat buffer. */
|
|
|
|
|
static error_t
|
|
|
|
|
open_file (const char *file_name, int mode,
|
|
|
|
|
mach_port_t *memobj_rd, struct stat *stat)
|
1995-05-11 01:02:23 +00:00
|
|
|
|
{
|
|
|
|
|
enum retry_type doretry;
|
|
|
|
|
char retryname[1024]; /* XXX string_t LOSES! */
|
|
|
|
|
file_t startdir, newpt, fileport;
|
|
|
|
|
int dealloc_dir;
|
|
|
|
|
int nloops;
|
1995-10-09 07:06:29 +00:00
|
|
|
|
error_t err;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
|
|
|
|
|
assert (mode == O_RDONLY);
|
|
|
|
|
|
|
|
|
|
startdir = _dl_hurd_data->portarray[file_name[0] == '/' ?
|
|
|
|
|
INIT_PORT_CRDIR : INIT_PORT_CWDIR];
|
|
|
|
|
|
|
|
|
|
while (file_name[0] == '/')
|
|
|
|
|
file_name++;
|
|
|
|
|
|
1996-07-30 19:23:06 +00:00
|
|
|
|
if (err = __dir_lookup (startdir, (char *)file_name, mode, 0,
|
1995-10-09 07:06:29 +00:00
|
|
|
|
&doretry, retryname, &fileport))
|
1996-07-30 19:23:06 +00:00
|
|
|
|
return err;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
|
|
|
|
|
dealloc_dir = 0;
|
|
|
|
|
nloops = 0;
|
1995-11-16 00:44:18 +00:00
|
|
|
|
|
1995-05-11 01:02:23 +00:00
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
if (dealloc_dir)
|
|
|
|
|
__mach_port_deallocate (__mach_task_self (), startdir);
|
1995-10-09 07:06:29 +00:00
|
|
|
|
if (err)
|
1996-07-30 19:23:06 +00:00
|
|
|
|
return err;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
|
|
|
|
|
switch (doretry)
|
|
|
|
|
{
|
|
|
|
|
case FS_RETRY_REAUTH:
|
|
|
|
|
{
|
|
|
|
|
mach_port_t ref = __mach_reply_port ();
|
1995-10-09 07:06:29 +00:00
|
|
|
|
err = __io_reauthenticate (fileport, ref, MACH_MSG_TYPE_MAKE_SEND);
|
|
|
|
|
if (! err)
|
|
|
|
|
err = __auth_user_authenticate
|
1995-05-11 01:02:23 +00:00
|
|
|
|
(_dl_hurd_data->portarray[INIT_PORT_AUTH],
|
|
|
|
|
ref, MACH_MSG_TYPE_MAKE_SEND,
|
|
|
|
|
&newpt);
|
|
|
|
|
__mach_port_destroy (__mach_task_self (), ref);
|
|
|
|
|
}
|
|
|
|
|
__mach_port_deallocate (__mach_task_self (), fileport);
|
1995-10-09 07:06:29 +00:00
|
|
|
|
if (err)
|
1996-07-30 19:23:06 +00:00
|
|
|
|
return err;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
fileport = newpt;
|
|
|
|
|
/* Fall through. */
|
|
|
|
|
|
|
|
|
|
case FS_RETRY_NORMAL:
|
|
|
|
|
#ifdef SYMLOOP_MAX
|
|
|
|
|
if (nloops++ >= SYMLOOP_MAX)
|
1996-07-30 19:23:06 +00:00
|
|
|
|
return ELOOP;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* An empty RETRYNAME indicates we have the final port. */
|
|
|
|
|
if (retryname[0] == '\0')
|
|
|
|
|
{
|
1996-07-30 19:23:06 +00:00
|
|
|
|
mach_port_t memobj_wr;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
|
|
|
|
|
dealloc_dir = 1;
|
|
|
|
|
|
|
|
|
|
opened:
|
|
|
|
|
/* We have the file open. Now map it. */
|
1996-07-30 19:23:06 +00:00
|
|
|
|
|
|
|
|
|
if (stat)
|
|
|
|
|
err = __io_stat (fileport, stat);
|
|
|
|
|
if (! err)
|
|
|
|
|
err = __io_map (fileport, memobj_rd, &memobj_wr);
|
|
|
|
|
|
1995-05-11 01:02:23 +00:00
|
|
|
|
if (dealloc_dir)
|
|
|
|
|
__mach_port_deallocate (__mach_task_self (), fileport);
|
1995-10-09 07:06:29 +00:00
|
|
|
|
if (err)
|
1996-07-30 19:23:06 +00:00
|
|
|
|
return err;
|
|
|
|
|
|
1995-05-11 01:02:23 +00:00
|
|
|
|
if (memobj_wr != MACH_PORT_NULL)
|
|
|
|
|
__mach_port_deallocate (__mach_task_self (), memobj_wr);
|
|
|
|
|
|
1996-07-30 19:23:06 +00:00
|
|
|
|
return 0;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
startdir = fileport;
|
|
|
|
|
dealloc_dir = 1;
|
|
|
|
|
file_name = retryname;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FS_RETRY_MAGICAL:
|
|
|
|
|
switch (retryname[0])
|
|
|
|
|
{
|
|
|
|
|
case '/':
|
|
|
|
|
startdir = _dl_hurd_data->portarray[INIT_PORT_CRDIR];
|
|
|
|
|
dealloc_dir = 0;
|
|
|
|
|
if (fileport != MACH_PORT_NULL)
|
|
|
|
|
__mach_port_deallocate (__mach_task_self (), fileport);
|
|
|
|
|
file_name = &retryname[1];
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'f':
|
1996-05-04 13:57:05 +00:00
|
|
|
|
if (retryname[1] == 'd' && retryname[2] == '/' &&
|
|
|
|
|
isdigit (retryname[3]))
|
1995-05-11 01:02:23 +00:00
|
|
|
|
{
|
1996-05-04 13:57:05 +00:00
|
|
|
|
/* We can't use strtol for the decoding here
|
|
|
|
|
because it brings in hairy locale bloat. */
|
|
|
|
|
char *p;
|
|
|
|
|
int fd = 0;
|
|
|
|
|
for (p = &retryname[3]; isdigit (*p); ++p)
|
|
|
|
|
fd = (fd * 10) + (*p - '0');
|
|
|
|
|
/* Check for excess text after the number. A slash is
|
|
|
|
|
valid; it ends the component. Anything else does not
|
|
|
|
|
name a numeric file descriptor. */
|
|
|
|
|
if (*p != '/' && *p != '\0')
|
1996-07-30 19:23:06 +00:00
|
|
|
|
return ENOENT;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
if (fd < 0 || fd >= _dl_hurd_data->dtablesize ||
|
|
|
|
|
_dl_hurd_data->dtable[fd] == MACH_PORT_NULL)
|
1995-10-09 07:06:29 +00:00
|
|
|
|
/* If the name was a proper number, but the file
|
|
|
|
|
descriptor does not exist, we return EBADF instead
|
|
|
|
|
of ENOENT. */
|
1996-07-30 19:23:06 +00:00
|
|
|
|
return EBADF;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
fileport = _dl_hurd_data->dtable[fd];
|
1996-05-04 13:57:05 +00:00
|
|
|
|
if (*p == '\0')
|
1995-05-11 01:02:23 +00:00
|
|
|
|
{
|
|
|
|
|
/* This descriptor is the file port we want. */
|
|
|
|
|
dealloc_dir = 0;
|
|
|
|
|
goto opened;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Do a normal retry on the remaining components. */
|
|
|
|
|
startdir = fileport;
|
|
|
|
|
dealloc_dir = 1;
|
1996-05-04 13:57:05 +00:00
|
|
|
|
file_name = p + 1; /* Skip the slash. */
|
1995-05-11 01:02:23 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
goto bad_magic;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'm':
|
|
|
|
|
if (retryname[1] == 'a' && retryname[2] == 'c' &&
|
|
|
|
|
retryname[3] == 'h' && retryname[4] == 't' &&
|
|
|
|
|
retryname[5] == 'y' && retryname[6] == 'p' &&
|
|
|
|
|
retryname[7] == 'e')
|
|
|
|
|
{
|
|
|
|
|
error_t err;
|
|
|
|
|
struct host_basic_info hostinfo;
|
|
|
|
|
mach_msg_type_number_t hostinfocnt = HOST_BASIC_INFO_COUNT;
|
|
|
|
|
char *p;
|
|
|
|
|
if (err = __host_info (__mach_host_self (), HOST_BASIC_INFO,
|
|
|
|
|
(natural_t *) &hostinfo,
|
|
|
|
|
&hostinfocnt))
|
|
|
|
|
return err;
|
|
|
|
|
if (hostinfocnt != HOST_BASIC_INFO_COUNT)
|
|
|
|
|
return EGRATUITOUS;
|
|
|
|
|
p = _itoa (hostinfo.cpu_subtype, &retryname[8], 10, 0);
|
|
|
|
|
*--p = '/';
|
|
|
|
|
p = _itoa (hostinfo.cpu_type, &retryname[8], 10, 0);
|
|
|
|
|
if (p < retryname)
|
|
|
|
|
abort (); /* XXX write this right if this ever happens */
|
|
|
|
|
if (p > retryname)
|
|
|
|
|
strcpy (retryname, p);
|
|
|
|
|
startdir = fileport;
|
|
|
|
|
dealloc_dir = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
goto bad_magic;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 't':
|
|
|
|
|
if (retryname[1] == 't' && retryname[2] == 'y')
|
|
|
|
|
switch (retryname[3])
|
|
|
|
|
{
|
|
|
|
|
error_t opentty (file_t *result)
|
|
|
|
|
{
|
|
|
|
|
error_t err;
|
|
|
|
|
file_t unauth;
|
|
|
|
|
err = __termctty_open_terminal
|
|
|
|
|
(_dl_hurd_data->portarray[INIT_PORT_CTTYID],
|
|
|
|
|
mode, &unauth);
|
|
|
|
|
if (! err)
|
|
|
|
|
{
|
|
|
|
|
mach_port_t ref = __mach_reply_port ();
|
1995-08-14 22:49:23 +00:00
|
|
|
|
err = __io_reauthenticate
|
1995-05-11 01:02:23 +00:00
|
|
|
|
(unauth, ref, MACH_MSG_TYPE_MAKE_SEND);
|
|
|
|
|
if (! err)
|
|
|
|
|
err = __auth_user_authenticate
|
|
|
|
|
(_dl_hurd_data->portarray[INIT_PORT_AUTH],
|
|
|
|
|
ref, MACH_MSG_TYPE_MAKE_SEND,
|
|
|
|
|
result);
|
|
|
|
|
__mach_port_deallocate (__mach_task_self (),
|
|
|
|
|
unauth);
|
|
|
|
|
__mach_port_destroy (__mach_task_self (), ref);
|
|
|
|
|
}
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case '\0':
|
1995-10-09 07:06:29 +00:00
|
|
|
|
if (err = opentty (&fileport))
|
1996-07-30 19:23:06 +00:00
|
|
|
|
return err;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
dealloc_dir = 1;
|
|
|
|
|
goto opened;
|
|
|
|
|
case '/':
|
1995-10-09 07:06:29 +00:00
|
|
|
|
if (err = opentty (&startdir))
|
1996-07-30 19:23:06 +00:00
|
|
|
|
return err;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
dealloc_dir = 1;
|
|
|
|
|
strcpy (retryname, &retryname[4]);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
goto bad_magic;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
goto bad_magic;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
bad_magic:
|
1996-07-30 19:23:06 +00:00
|
|
|
|
return EGRATUITOUS;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
}
|
1995-11-16 00:44:18 +00:00
|
|
|
|
break;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
|
|
|
|
|
default:
|
1996-07-30 19:23:06 +00:00
|
|
|
|
return EGRATUITOUS;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
1996-07-30 19:23:06 +00:00
|
|
|
|
err = __dir_lookup (startdir, (char *)file_name, mode, 0,
|
1995-10-09 07:06:29 +00:00
|
|
|
|
&doretry, retryname, &fileport);
|
1995-05-11 01:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-30 19:23:06 +00:00
|
|
|
|
int weak_function
|
|
|
|
|
__open (const char *file_name, int mode, ...)
|
|
|
|
|
{
|
|
|
|
|
mach_port_t memobj_rd;
|
|
|
|
|
error_t err = open_file (file_name, mode, &memobj_rd, 0);
|
|
|
|
|
if (err)
|
|
|
|
|
return __hurd_fail (err);
|
|
|
|
|
else
|
|
|
|
|
return (int)memobj_rd;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-08 06:18:25 +00:00
|
|
|
|
int weak_function
|
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open.
(__close, __mmap): Likewise define with __ names now.
Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* elf/dl-support.c: New file.
* elf/Makefile (CFLAGS-dl-support.c): New variable.
(routines, elide-routines.so): Add dl-support.
* elf/dl-minimal.c (_dl_pagesize): Remove common defn.
* elf/dl-load.c (_dl_pagesize): Define it here.
(_dl_map_object_from_fd): Initialize it if zero.
* elf/link.h (_dl_pagesize): Remove const.
Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* elf/Makefile (routines): Add dl-symbol.
* elf/dl-lookup.c (_dl_symbol_value): Moved to ...
* elf/dl-symbol.c: New file.
* elf/elf.h (Elf32_Xword, Elf32_Sxword): New types.
(Elf32_Section, Elf64_Section): New types, 16 bits.
(Elf32_Sym, Elf64_Sym): Use it.
* elf/dl-deps.c (_dl_open): Moved to ...
* elf/dl-open.c: New file.
* Makefile (routines): Add dl-open.
* elf/Makefile (dl-routines): New variable.
(routines): Add $(dl-routines).
(elide-routines.so): New variable, set to $(dl-routines).
(libdl-inhibit-o): Variable removed; build all flavors of -ldl.
(rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to
$(dl-routines).
* elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage.
* elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND.
* elf/dl-load.c (open_path): Use __ names for open and close. Avoid
using strdup.
(_dl_map_object): Likewise.
(_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect.
* elf/dl-minimal.c (malloc): Likewise.
* elf/dl-reloc.c (_dl_relocate_object): Likewise.
* elf/dl-minimal.c (_dl_pagesize): New variable.
(malloc): Use that instead of a static variable.
* elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of
calling getpagesize.
* elf/dl-load.c (_dl_map_object_from_fd): Likewise.
* elf/link.h: Declare _dl_pagesize.
* elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug.
* elf/link.h (struct link_map): Use Half for l_phnum instead of Word.
* elf/rtld.c (dl_main): Use Half for phdr count arg.
(_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg.
* elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to
extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against
native wordsize, either 32 or 64.
* elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a
char is always a byte, no need for a typedef. Section indices are
16-bit quantities in elf64, which already have a typedef Elf64_Half.
Remove partial -lelf implementation. There is now a
separately-distributed `libelf' package that implements it.
* elf/dl-lookup.c: Don't #include <libelf.h> any more.
(_dl_elf_hash): New function, moved from
libelf.h:elf_hash.
(_dl_lookup_symbol): Use it instead of elf_hash.
* elf/libelf.h: File removed.
* elf/elf_hash.c: File removed.
* elf/Makefile (headers): Remove libelf.h.
(extra-libs): Remove libelf.
(libelf-routines): Variable removed.
* elf/Makefile (libdl.so): Remove commands from this target. The
implicit rule commands are correct, this explicit rule just serves to
add some dependencies.
* elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of
ELF32_ST_TYPE. Likewise ST_BIND.
* elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM.
* elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type
naming.
(ELFW): New macro, likewise for ELFXX_* macro naming.
(_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF.
Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c,
elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c,
elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c,
elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to
`ElfW(XXX)' for wordsize-independence.
Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu>
* elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts.
(Elf64_auxv_t): New type.
(EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 10:18:47 +00:00
|
|
|
|
__close (int fd)
|
1995-05-11 01:02:23 +00:00
|
|
|
|
{
|
|
|
|
|
if (fd != (int) MACH_PORT_NULL)
|
|
|
|
|
__mach_port_deallocate (__mach_task_self (), (mach_port_t) fd);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-08 06:18:25 +00:00
|
|
|
|
caddr_t weak_function
|
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open.
(__close, __mmap): Likewise define with __ names now.
Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* elf/dl-support.c: New file.
* elf/Makefile (CFLAGS-dl-support.c): New variable.
(routines, elide-routines.so): Add dl-support.
* elf/dl-minimal.c (_dl_pagesize): Remove common defn.
* elf/dl-load.c (_dl_pagesize): Define it here.
(_dl_map_object_from_fd): Initialize it if zero.
* elf/link.h (_dl_pagesize): Remove const.
Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* elf/Makefile (routines): Add dl-symbol.
* elf/dl-lookup.c (_dl_symbol_value): Moved to ...
* elf/dl-symbol.c: New file.
* elf/elf.h (Elf32_Xword, Elf32_Sxword): New types.
(Elf32_Section, Elf64_Section): New types, 16 bits.
(Elf32_Sym, Elf64_Sym): Use it.
* elf/dl-deps.c (_dl_open): Moved to ...
* elf/dl-open.c: New file.
* Makefile (routines): Add dl-open.
* elf/Makefile (dl-routines): New variable.
(routines): Add $(dl-routines).
(elide-routines.so): New variable, set to $(dl-routines).
(libdl-inhibit-o): Variable removed; build all flavors of -ldl.
(rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to
$(dl-routines).
* elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage.
* elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND.
* elf/dl-load.c (open_path): Use __ names for open and close. Avoid
using strdup.
(_dl_map_object): Likewise.
(_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect.
* elf/dl-minimal.c (malloc): Likewise.
* elf/dl-reloc.c (_dl_relocate_object): Likewise.
* elf/dl-minimal.c (_dl_pagesize): New variable.
(malloc): Use that instead of a static variable.
* elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of
calling getpagesize.
* elf/dl-load.c (_dl_map_object_from_fd): Likewise.
* elf/link.h: Declare _dl_pagesize.
* elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug.
* elf/link.h (struct link_map): Use Half for l_phnum instead of Word.
* elf/rtld.c (dl_main): Use Half for phdr count arg.
(_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg.
* elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to
extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against
native wordsize, either 32 or 64.
* elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a
char is always a byte, no need for a typedef. Section indices are
16-bit quantities in elf64, which already have a typedef Elf64_Half.
Remove partial -lelf implementation. There is now a
separately-distributed `libelf' package that implements it.
* elf/dl-lookup.c: Don't #include <libelf.h> any more.
(_dl_elf_hash): New function, moved from
libelf.h:elf_hash.
(_dl_lookup_symbol): Use it instead of elf_hash.
* elf/libelf.h: File removed.
* elf/elf_hash.c: File removed.
* elf/Makefile (headers): Remove libelf.h.
(extra-libs): Remove libelf.
(libelf-routines): Variable removed.
* elf/Makefile (libdl.so): Remove commands from this target. The
implicit rule commands are correct, this explicit rule just serves to
add some dependencies.
* elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of
ELF32_ST_TYPE. Likewise ST_BIND.
* elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM.
* elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type
naming.
(ELFW): New macro, likewise for ELFXX_* macro naming.
(_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF.
Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c,
elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c,
elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c,
elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to
`ElfW(XXX)' for wordsize-independence.
Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu>
* elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts.
(Elf64_auxv_t): New type.
(EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 10:18:47 +00:00
|
|
|
|
__mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
|
1995-05-11 01:02:23 +00:00
|
|
|
|
{
|
1995-10-09 07:06:29 +00:00
|
|
|
|
error_t err;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
vm_prot_t vmprot;
|
|
|
|
|
vm_address_t mapaddr;
|
|
|
|
|
|
|
|
|
|
vmprot = VM_PROT_NONE;
|
|
|
|
|
if (prot & PROT_READ)
|
|
|
|
|
vmprot |= VM_PROT_READ;
|
|
|
|
|
if (prot & PROT_WRITE)
|
|
|
|
|
vmprot |= VM_PROT_WRITE;
|
|
|
|
|
if (prot & PROT_EXEC)
|
|
|
|
|
vmprot |= VM_PROT_EXECUTE;
|
|
|
|
|
|
|
|
|
|
mapaddr = (vm_address_t) addr;
|
1995-10-09 07:06:29 +00:00
|
|
|
|
err = __vm_map (__mach_task_self (),
|
|
|
|
|
&mapaddr, (vm_size_t) len, 0 /*ELF_MACHINE_USER_ADDRESS_MASK*/,
|
|
|
|
|
!(flags & MAP_FIXED),
|
Sun Jul 14 01:51:39 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* manual/Makefile (glibc-targets): Variable and targets removed.
Sat Jul 13 23:50:17 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* manual/Makefile (lib): New phony target. Depend on stamp files.
($(objpfx)stamp%-$(subdir)): New rule to create them when necessary.
1996-07-13 Paul Eggert <eggert@twinsun.com>
* time/strftime.c (strftime): Use space padding for %e, %k, %l,
to match Emacs format-time-string specification.
(DO_NUMBER_SPACEPAD): Renamed from DO_NUMBER_NOPAD.
Sat Jul 13 20:17:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* elf/dl-deps.c (_dl_map_object_deps): Take new args PRELOADS and
NPRELOADS, vector of `struct link_map *'s; add them to the searchlist
between MAP and its deps.
* elf/link.h: Fix decl.
* elf/rtld.c (dl_main): If not secure, parse LD_PRELOAD for
colon-separated list of names, map those and pass vector of ptrs as
PRELOADS list to _dl_map_object_deps.
* elf/dl-runtime.c (_dl_object_relocation_scope): Pass new args to
_dl_map_object_deps with empty preload list.
* elf/dl-open.c (_dl_open): Likewise.
* sysdeps/mach/hurd/dl-sysdep.c (_dl_sysdep_open_zero_fill): Function
removed.
(__mmap): Pass MACH_PORT_NULL for memobj port when (flags & MAP_ANON).
* sysdeps/generic/dl-sysdep.c (_dl_sysdep_open_zero_fill):
Conditionalize defn on [! MAP_ANON].
* elf/dl-minimal.c (malloc): Conditionalize use of _dl_zerofd
on [! MAP_ANON].
* elf/rtld.c (dl_main): Likewise.
* elf/dl-load.c (_dl_zerofd): Conditionalize defn on [! MAP_ANON].
(_dl_map_object_from_fd): Conditionalize initialization of _dl_zerofd.
* elf/dl-fini.c (_dl_fini): Skip finalizer for executable itself.
Sat Jul 13 02:47:53 1996 David Mosberger-Tang <davidm@azstarnet.com>
* stdlib/random.c (__random): Declare as int32_t to be in sync
with declaration.
* socket/Makefile (headers): Add socketbits.h.
* misc/mntent.c (endmntent): Allow for NULL stream. SunOS does
it that way.
* grp/initgroups.c (initgroups): Add groups that user is a member
of, not the ones he is _not_ a member of.
* nss/nsswitch.c (known_compare): Make known_compare() a static
instead of a local function. The latter are difficult to debug
and slow to execute on certain platforms.
* sysdeps/posix/ttyname_r.c (ttyname_r): Use sizeof (dev) - 1 in
place of sizeof (dev). The size of a literal string includes the
NUL byte.
* sysdeps/unix/getlogin.c (getlogin): Initialize ut_fd with -1.
Thu Jul 11 16:59:10 1996 David Mosberger-Tang <davidm@azstarnet.com>
* misc/mntent.c (addmntent): Seek to end of file before writing
entry. Return 1 on error, not -1.
Tue Jul 9 19:08:05 1996 David Mosberger-Tang <davidm@azstarnet.com>
* sysdeps/unix/sysv/linux/syscalls.list: Mark bdflush as EXTRA
syscall.
Fri Jul 5 18:44:55 1996 David Mosberger-Tang <davidm@azstarnet.com>
* sysdeps/unix/sysv/linux/alpha/ioperm.c (port_to_cpu_addr): Size
shift amount for Jensen must be 5 not 4.
Sat Jul 13 20:04:28 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* socket/sys/socket.h (struct osockaddr): New type.
Sat Jul 13 03:50:53 1996 Ulrich Drepper <drepper@cygnus.com>
* misc/Makefile (routines): Add qefgcvt and qefgcvt_r.
* misc/efgcvt.c, misc/efgcvt_r.c: Change code so that the `double'
and `long double' versions can be generated.
* misc/qefgcvt.c, misc/qefgcvt_r.c: New files. Define macros
so that included efgcvt{,_r}.c file generate `long double'
versions.
* stdlib/stdlib.h: Add prototypes for q[efg]cvt() and q[ef]cvt_r()
functions.
* manual/startup.texi: Document new getsubopt function.
* manual/examples/subopt.c: New example program for documenting
getsubopt function.
Fri Jul 12 23:58:37 1996 Ulrich Drepper <drepper@cygnus.com>
* stdlib/Makefile (routines): Add getsubopt.
* stdlib/stdlib.h: Add prototype for getsubopt.
* stdlib/getsubopt.c: New file. Implement getsubopt function
to handle suboption parsing.
1996-07-14 06:04:09 +00:00
|
|
|
|
(flags & MAP_ANON) ? MACH_PORT_NULL : (mach_port_t) fd,
|
|
|
|
|
(vm_offset_t) offset,
|
1995-10-09 07:06:29 +00:00
|
|
|
|
flags & (MAP_COPY|MAP_PRIVATE),
|
|
|
|
|
vmprot, VM_PROT_ALL,
|
1995-12-19 10:00:22 +00:00
|
|
|
|
(flags & MAP_SHARED) ? VM_INHERIT_SHARE : VM_INHERIT_COPY);
|
1996-01-10 10:00:22 +00:00
|
|
|
|
if (err == KERN_NO_SPACE && (flags & MAP_FIXED))
|
|
|
|
|
{
|
Update.
1997-05-24 03:51 Ulrich Drepper <drepper@cygnus.com>
* stdlib/Makefile (routines): Add strtol_l, strtoul_l, strtoll_l,
strtoull_l, strtof_l, strtod_l, and strtold_l.
* stdlib/stdlib.h: Add prototypes for new functions.
* stdlib/strtod.c: Change for compiling as strtoX_l.
* stdlib/strtol.c: Likewise.
* stdlib/strtof.c: Likewise.
* stdlib/strtold.c: Likewise.
* stdlib/strtod_l.c: New file.
* stdlib/strtof_l.c: New file.
* stdlib/strtold_l.c: New file.
* stdlib/strtol_l.c: New file.
* stdlib/strtoul_l.c: New file.
* stdlib/strtoll_l.c: New file.
* stdlib/strtoull_l.c: New file.
* string/Makefile (routines): Add strcasecmp_l and strncase_l.
* string/string.h: Add prototypes for new functions.
* sysdeps/generic/strcasecmp.c: Change for compiling as strcasecmp_l.
* sysdeps/generic/strncase.c: Change for compiling as strncasecmp_l.
* sysdeps/generic/strcasecmp_l.c: New file.
* sysdeps/generic/strncase_l.c: New file.
* wcsmbs/Makefile (routines): Add wcstol_l, wcstoul_l, wcstoll_l,
wcstoull_l, wcstod_l, wcstold_l, wcstof_l, wcscasecmp_l, and
wcsncase_l.
* wcsmbs/wchar.h: Add prototypes for new functions.
* wcsmbs/wcscasecmp.c: Change for compiling as wcscasecmp_l.
* wcsmbs/wcsncase.c: Change for compiling as wcsncasecmp_l.
* wcsmbs/wcscasecmp_l.c: New file.
* wcsmbs/wcsncase_l.c: New file.
* wcsmbs/wcstof.c: Change for compiling as wcstof_l.c
* wcsmbs/wcstold.c: Change for compiling as wcstold_l.c
* wcsmcs/wcstod_l.c: New file.
* wcsmcs/wcstof_l.c: New file.
* wcsmcs/wcstold_l.c: New file.
* wcsmcs/wcstol_l.c: New file.
* wcsmcs/wcstoul_l.c: New file.
* wcsmcs/wcstoll_l.c: New file.
* wcsmcs/wcstoull_l.c: New file.
* Makeconfig (binfmt-subdir): New variable. Set to `elf' if
$(elf) is defined. More to come later when other binary formats
are supported.
* Makefile (subdirs): Remove elf. Add $(binfmt-subdir).
Suggested by Philip Blundell.
* stdlib/Makefile (headers): Add fmtmsg.h.
(routines): Add fmtmsg.
* stdlib/fmtmsg.c: New file.
* stdlib/fmtmsg.h: New file.
* manual/stdio.texi: Add description of fmtmsg and addseverity.
* manual/examples/fmtmsgexpl.c: Example program for fmtmsg
documentation.
1997-05-23 15:26 Philip Blundell <pjb27@cam.ac.uk>
* resolv/res_query.c (res_querydomain): Avoid potential buffer
overrun. Reported by Dan A. Dickey <ddickey@transition.com>.
1997-05-22 18:36 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* elf/dl-support.c (_dl_sysdep_open_zero_fill,
_dl_sysdep_read_whole_file): Moved functions to ...
* elf/dl-misc.c: This new file.
* sysdeps/generic/dl-sysdepio.c: Delete file and move functions...
* elf/dl-misc.c: ... here.
* sysdeps/generic/dl-sysdep.c (_dl_sysdep_open_zero_fill,
_dl_sysdep_read_whole_file): Delete functions; they now come from
elf/dl-misc.c (dl-support.c had contained identical versions).
* sysdeps/mach/hurd/dl-sysdepio.c: Delete file; move functions...
* sysdeps/mach/hurd/dl-sysdep.c: ... here, but mark them weak so
that the regular ones in dl-misc work once we've initialized.
* elf/Makefile (dl-routines): Remove dl-sysdepio.c. Add dl-misc.c.
1997-05-22 21:55 Philip Blundell <pjb27@cam.ac.uk>
* inet/Makefile (headers): Add netinet/inbits.h.
* inet/netinet/in.h: New file.
* sysdeps/generic/netinet/inbits.h: Likewise.
* sysdeps/unix/sysv/linux/netinet/inbits.h: Likewise.
* sysdeps/generic/netinet/ip6.h: Move to...
* inet/netinet/ip6.h: ... here.
* sysdeps/generic/netinet/icmp6.h: Move to...
* inet/netinet/icmp6.h: ... here.
* sysdeps/unix/sysv/linux/netinet/in.h: Remove.
* sysdeps/generic/netinet/in.h: Remove.
1997-05-22 05:40 Richard Henderson <rth@tamu.edu>
* sysdeps/alpha/dl-machine.h (elf_machine_runtime_setup): If we are
not looking at the new thread-safe .plt, don't be lazy about relocs.
(_dl_runtime_resolve): Fix up arithmetic for new .plt layout.
(elf_alpha_fix_plt): Insert wmb as appropriate to ensure safety.
* elf/dynamic-link.h (ELF_DYNAMIC_RELOCATE): Let
elf_machine_runtime_setup() decide if we can actually be lazy.
* elf/rtld.c (_dl_start): So don't call it.
* elf/dl-reloc.c (_dl_relocate_object): Likewise.
* sysdeps/i386/dl-machine.h (elf_machine_runtime_setup): Return lazy.
* sysdeps/m68k/dl-machine.h (elf_machine_runtime_setup): Likewise.
* sysdeps/mips/dl-machine.h (elf_machine_runtime_setup): Likewise.
* sysdeps/powerpc/dl-machine.h (elf_machine_runtime_setup): Likewise.
* sysdeps/sparc/dl-machine.h (elf_machine_runtime_setup): Likewise.
* sysdeps/stub/dl-machine.h (elf_machine_runtime_setup): Update
skeleton definition.
1997-05-22 18:45 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/i386/fpu/__math.h (logb): Remove second value placed on
stack by fxtract.
1997-05-22 13:07 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sunrpc/rpcsvc/rusers.x: Provide and correct prototypes,
add cast to (xdrproc_t) where necessary to prevent warnings.
1997-05-22 12:18 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c: Remove I/O functions.
* sunrpc/rpcinfo.c (get_inet_address): Use INADDR_NONE and INADDR_ANY
* sysdeps/libm-ieee754/s_cexp.c: Fix typo: string_alias ->
* nss/XXX-lookup.c: Add missing explanation.
1997-05-24 02:30:09 +00:00
|
|
|
|
|
|
|
|
|
void weak_function
|
|
|
|
|
_dl_sysdep_fatal (const char *msg, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
|
|
va_start (ap, msg);
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
size_t len = strlen (msg);
|
|
|
|
|
mach_msg_type_number_t nwrote;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (__io_write (_hurd_init_dtable[2], msg, len, -1, &nwrote))
|
|
|
|
|
break;
|
|
|
|
|
len -= nwrote;
|
|
|
|
|
msg += nwrote;
|
|
|
|
|
} while (nwrote > 0);
|
|
|
|
|
msg = va_arg (ap, const char *);
|
|
|
|
|
} while (msg);
|
|
|
|
|
va_end (ap);
|
|
|
|
|
|
|
|
|
|
_exit (127);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void weak_function
|
|
|
|
|
_dl_sysdep_error (const char *msg, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
|
|
va_start (ap, msg);
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
size_t len = strlen (msg);
|
|
|
|
|
mach_msg_type_number_t nwrote;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (__io_write (_hurd_init_dtable[2], msg, len, -1, &nwrote))
|
|
|
|
|
break;
|
|
|
|
|
len -= nwrote;
|
|
|
|
|
msg += nwrote;
|
|
|
|
|
} while (nwrote > 0);
|
|
|
|
|
msg = va_arg (ap, const char *);
|
|
|
|
|
} while (msg);
|
|
|
|
|
va_end (ap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void weak_function
|
|
|
|
|
_dl_sysdep_message (const char *msg, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
|
|
va_start (ap, msg);
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
size_t len = strlen (msg);
|
|
|
|
|
mach_msg_type_number_t nwrote;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if (__io_write (_hurd_init_dtable[1], msg, len, -1, &nwrote))
|
|
|
|
|
break;
|
|
|
|
|
len -= nwrote;
|
|
|
|
|
msg += nwrote;
|
|
|
|
|
} while (nwrote > 0);
|
|
|
|
|
msg = va_arg (ap, const char *);
|
|
|
|
|
} while (msg);
|
|
|
|
|
va_end (ap);
|
|
|
|
|
}
|
1996-01-10 10:00:22 +00:00
|
|
|
|
/* XXX this is not atomic as it is in unix! */
|
|
|
|
|
/* The region is already allocated; deallocate it first. */
|
|
|
|
|
err = __vm_deallocate (__mach_task_self (), mapaddr, len);
|
|
|
|
|
if (! err)
|
|
|
|
|
err = __vm_map (__mach_task_self (),
|
|
|
|
|
&mapaddr, (vm_size_t) len, 0 /*ELF_MACHINE_USER_ADDRESS_MASK*/,
|
|
|
|
|
!(flags & MAP_FIXED),
|
|
|
|
|
(mach_port_t) fd, (vm_offset_t) offset,
|
|
|
|
|
flags & (MAP_COPY|MAP_PRIVATE),
|
|
|
|
|
vmprot, VM_PROT_ALL,
|
|
|
|
|
(flags & MAP_SHARED)
|
|
|
|
|
? VM_INHERIT_SHARE : VM_INHERIT_COPY);
|
|
|
|
|
}
|
|
|
|
|
|
1995-10-09 07:06:29 +00:00
|
|
|
|
return err ? (caddr_t) __hurd_fail (err) : (caddr_t) mapaddr;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
1996-07-08 06:18:25 +00:00
|
|
|
|
void weak_function
|
1995-05-11 01:02:23 +00:00
|
|
|
|
_exit (int status)
|
|
|
|
|
{
|
1995-08-14 22:49:23 +00:00
|
|
|
|
__proc_mark_exit (_dl_hurd_data->portarray[INIT_PORT_PROC],
|
Tue May 7 19:00:01 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* string/argz-extract.c: Remove const from decl.
* string/argz.h: Here too.
* Makeconfig (version.mk): Fix regexp in sed cmd.
Depend on $(..)Makeconfig.
* GMP code updated from gmp-2.0 release.
* stdlib/Makefile (mpn-routines): Removed add_1, added inlines.
* sysdeps/generic/add_1.c: File removed.
* stdlib/strtod.c: mp_limb is now mp_limb_t.
* stdlib/fpioconst.c, stdlib/fpioconst.h: Likewise.
* stdio-common/_itoa.c: Likewise.
* stdio-common/printf_fp.c: Likewise.
Don't include ansidecl.h.
* sysdeps/mach/hurd/getcwd.c: Use io_identity instead of io_stat.
* shlib-versions: New file.
* Makerules (soversions.mk): New target, include file generated from
shlib-versions. Moved shared library rules before installation rules.
Rewrote shared library installation rules for versioned libraries.
* math/Makefile (libm.so-version): Variable removed.
* sysdeps/mach/hurd/i386/exc2signal.c: Use struct hurd_signal_detail.
* hurd/report-wait.c (_S_msg_describe_ports): New function.
* configure.in: Add AC_PROG_LN_S check.
* config.make.in (LN_S): New variable.
Sun May 5 03:10:44 1996 Ulrich Drepper <drepper@cygnus.com>
* misc/efgcvt_r.c (ecvt_r): Work aroung gcc bug. gcc does
not know about weak aliases now and optimizes necessary `if'
statement away.
* posix/unistd.h: Add swapoff prototype.
* sysdeps/generic/confname.h: Add even more POSIX.4 symbols.
* sysdeps/posix/fpathconf.c (__fpathconf): Get information
for _PC_PATH_MAX from fstatfs function if available.
* sysdeps/posix/sysconf.c: Add code to handle _SC_AIO_LISTIO_MAX,
_SC_AIO_MAX, _SC_AIO_PRIO_DELTA_MAX, _SC_DELAYTIMER_MAX,
_SC_MQ_OPEN_MAX, _SC_MQ_PRIO_MAX, _SC_RTSIG_MAX,
_SC_SEM_NSEMS_MAX, _SC_SEM_VALUE_MAX, _SC_SIGQUEUE_MAX, and
_SC_TIMER_MAX.
* sysdeps/unix/sysv/sysv4/sysconf.c: Ditto.
* sysdeps/stub/swapoff.c: New file. Stub version for swapoff
function.
* sysdeps/unix/syscalls.list: Add swapoff.
* sysdeps/unix/sysv/linux/Dist: Add sys/acct.h.
* sysdeps/unix/sysv/linux/Makefile [$(subdir) == misc]
(sysdep_routines): Add mount, umount, llseek, setfsgid, setfsuid,
sysinfo, and uselib.
(headers): Add sys/sysinfo.h.
* sysdeps/unix/sysv/linux/gethostid.c: Prevent warning.
* sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) == misc]
(sysdep_routines): Add ioperm, iopl, and vm86.
(headers): Add sys/perm.h and sys/vm86.h.
* sysdeps/unix/sysv/linux/i386/sys/perm.h: New file. Contains
prototypes for iopl and ioperm.
* sysdeps/unix/sysv/linux/i386/sys/vm86.h: New file. Contains
prototype for vm86.
* sysdeps/unix/sysv/linux/i386/syscalls.list: New file. Add
vm86 system call.
* sysdeps/unix/sysv/linux/sys/acct.h: New file. Contains
prototypes for acct function.
* sysdeps/unix/sysv/linux/sys/socket.h: Provide real header
file with prototypes.
* sysdeps/unix/sysv/linux/sys/sysinfo.h: New file. Contains
prototype for sysinfo function.
* sysdeps/unix/sysv/linux/syscalls.list: Add flock, ioperm, iopl,
llseek, setfsgid, setfsuid, sysinfo, and uselib.
* sysdeps/unix/sysv/linux/sysconf.c: Instead of duplicating
posix/sysconf.c now only handle cases different to that
implementation.
Tue May 7 15:08:19 1996 Miles Bader <miles@gnu.ai.mit.edu>
* stdio/linewrap.c (__line_wrap_output): Renamed from lwoutput
(all references changed). Now exported.
* stdio/linewrap.c (struct data): Type deleted (moved to linewrap.h).
(wrap_stream, unwrap_stream, lwclose, lwfileno, lwoutput,
line_wrap_stream, line_unwrap_stream): Use struct line_wrap_data
instead of struct data.
(lwoutput, line_wrap_stream, line_unwrap_stream): Rename various
occurences of `wrap' and `wrapmargin' to `wmargin'.
(line_wrapped, line_wrap_lmargin, line_wrap_set_lmargin,
line_wrap_rmargin, line_wrap_set_rmargin, line_wrap_wmargin,
line_wrap_set_wmargin, line_wrap_point): New functions.
* stdio/linewrap.h: New file.
* stdio/Makefile (headers): Add linewrap.h.
Tue May 7 14:19:12 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* sysdeps/unix/sysv/linux/i386/Makefile: File removed.
* stdio/stdio.h: Remove line_wrap_stream, line_unwap_stream decls.
* sysdeps/unix/sysv/linux/schedbits.h: New file.
Tue May 7 13:47:02 1996 Miles Bader <miles@gnu.ai.mit.edu>
* stdio/linewrap.c (struct data): Make margin fields not-pointers.
(lwoutput): Adjust uses acordingly.
* sysdeps/mach/hurd/fdatasync.c: New file.
* sysdeps/mach/hurd/fsync.c: Pass new flag to file_sync.
* sysdeps/mach/hurd/xmknod.c: Pass new flag to dir_link.
* sysdeps/mach/hurd/symlink.c: Likewise.
* sysdeps/mach/hurd/link.c: Likewise.
* sysdeps/mach/hurd/bind.c: Likewise.
* hurd/hurdsig.c (write_corefile): Likewise.
* hurd/hurdsig.c (write_corefile): Pass cttyid port to crash server.
* sysdeps/mach/hurd/fpathconf.c: RPC takes int pointer, not long int.
* sysdeps/mach/hurd/_exit.c (_hurd_exit): Pass sigcode arg to
proc_mark_exit.
* sysdeps/mach/hurd/dl-sysdep.c (_exit): Likewise.
* sysdeps/mach/hurd/wait4.c: Pass sigcode arg to proc_wait.
* sysdeps/mach/hurd/rename.c: Pass new flag to dir_rename.
* hurd/hurdfault.c (_hurdsig_fault_catch_exception_raise): Use struct
hurd_signal_detail.
* hurd/catch-exc.c (_S_catch_exception_raise): Likewise.
* hurd/hurd-raise.c (_hurd_raise_signal): Likewise.
* sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler):
Likewise.
* sysdeps/mach/hurd/setitimer.c (restart_itimer): Likewise.
* hurd/hurd/signal.h: Fix _hurd_exception2signal prototype.
* hurd/hurdsig.c (write_corefile): Take const struct
hurd_signal_detail * arg. Pass all details to crash_dump_task.
(_hurd_internal_post_signal): Pass DETAIL to write_corefile.
(_hurd_internal_post_signal: suspend): Pass code and error to
proc_mark_stop.
* hurd/hurdprio.c (_hurd_priority_which_map): Pass flags arg to
proc_getprocinfo by reference.
1996-05-08 02:07:47 +00:00
|
|
|
|
W_EXITCODE (status, 0), 0);
|
1995-05-11 01:02:23 +00:00
|
|
|
|
while (__task_terminate (__mach_task_self ()))
|
|
|
|
|
__mach_task_self_ = (__mach_task_self) ();
|
|
|
|
|
}
|
|
|
|
|
|
1996-07-30 19:23:06 +00:00
|
|
|
|
/* Read the whole contents of FILE into new mmap'd space with given
|
|
|
|
|
protections. The size of the file is returned in SIZE. */
|
|
|
|
|
void *
|
|
|
|
|
_dl_sysdep_read_whole_file (const char *file, size_t *size, int prot)
|
|
|
|
|
{
|
|
|
|
|
struct stat stat;
|
|
|
|
|
mach_port_t memobj_rd;
|
|
|
|
|
void *contents;
|
|
|
|
|
error_t err = open_file (file, O_RDONLY, &memobj_rd, &stat);
|
|
|
|
|
|
|
|
|
|
if (! err)
|
|
|
|
|
{
|
|
|
|
|
/* Map a copy of the file contents. */
|
|
|
|
|
contents = __mmap (0, stat.st_size, prot, MAP_COPY, memobj_rd, 0);
|
|
|
|
|
if (contents == (void *)-1)
|
|
|
|
|
contents = 0;
|
|
|
|
|
else
|
|
|
|
|
*size = stat.st_size;
|
1995-05-11 01:02:23 +00:00
|
|
|
|
|
1996-07-30 19:23:06 +00:00
|
|
|
|
__mach_port_deallocate (__mach_task_self (), memobj_rd);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
__hurd_fail (err);
|
|
|
|
|
contents = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return contents;
|
|
|
|
|
}
|
|
|
|
|
|
1995-08-14 22:49:23 +00:00
|
|
|
|
/* This function is called by interruptible RPC stubs. For initial
|
|
|
|
|
dynamic linking, just use the normal mach_msg. Since this defn is
|
1995-05-11 01:02:23 +00:00
|
|
|
|
weak, the real defn in libc.so will override it if we are linked into
|
|
|
|
|
the user program (-ldl). */
|
1995-08-14 22:49:23 +00:00
|
|
|
|
|
1996-07-08 06:18:25 +00:00
|
|
|
|
error_t weak_function
|
1995-08-14 22:49:23 +00:00
|
|
|
|
_hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
|
|
|
|
|
mach_msg_option_t option,
|
|
|
|
|
mach_msg_size_t send_size,
|
|
|
|
|
mach_msg_size_t rcv_size,
|
|
|
|
|
mach_port_t rcv_name,
|
|
|
|
|
mach_msg_timeout_t timeout,
|
|
|
|
|
mach_port_t notify)
|
|
|
|
|
{
|
|
|
|
|
return __mach_msg (msg, option, send_size, rcv_size, rcv_name,
|
|
|
|
|
timeout, notify);
|
|
|
|
|
}
|