-/* Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1992-2015 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 free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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.
+ 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
+ Lesser 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. */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <sys/stat.h>
#include <stdlib.h>
struct hurd_port *_hurd_ports;
unsigned int _hurd_nports;
mode_t _hurd_umask;
+sigset_t _hurdsig_traced;
+
+char **__libc_argv;
+int __libc_argc;
+
error_t
_hurd_ports_use (int which, error_t (*operate) (mach_port_t))
{
+ if (__glibc_unlikely (_hurd_ports == NULL))
+ /* This means that _hurd_init has not been called yet, which is
+ normally only the case in the bootstrap filesystem, and there
+ only in the early phases of booting. */
+ return EGRATUITOUS;
+
return HURD_PORT_USE (&_hurd_ports[which], (*operate) (port));
}
-void _hurd_proc_init (char **argv);
-
DEFINE_HOOK (_hurd_subinit, (void));
+__typeof (_hurd_proc_init) _hurd_new_proc_init; /* below */
+
/* Initialize the library data structures from the
ints and ports passed to us by the exec server.
__task_set_special_port (__mach_task_self (), TASK_BOOTSTRAP_PORT,
portarray[INIT_PORT_BOOTSTRAP]);
- /* Tell the proc server we exist, if it does. */
- if (portarray[INIT_PORT_PROC] != MACH_PORT_NULL)
- _hurd_proc_init (argv);
-
if (intarraysize > INIT_UMASK)
_hurd_umask = intarray[INIT_UMASK] & 0777;
else
_hurd_umask = CMASK;
+ if (intarraysize > INIT_TRACEMASK)
+ _hurdsig_traced = intarray[INIT_TRACEMASK];
+
+ /* Tell the proc server we exist, if it does. */
+ if (portarray[INIT_PORT_PROC] != MACH_PORT_NULL)
+ _hurd_new_proc_init (argv, intarray, intarraysize);
+
/* All done with init ints and ports. */
__vm_deallocate (__mach_task_self (),
(vm_address_t) intarray,
Call _hurdsig_init to set up signal processing. */
void
-_hurd_proc_init (char **argv)
+_hurd_new_proc_init (char **argv,
+ const int *intarray, size_t intarraysize)
{
mach_port_t oldmsg;
struct hurd_userlink ulink;
process_t procserver;
/* Initialize the signal code; Mach exceptions will become signals. */
- _hurdsig_init ();
+ _hurdsig_init (intarray, intarraysize);
/* The signal thread is now prepared to receive messages.
It is safe to give the port to the proc server. */
here, like _hurd_pid, are already initialized. */
RUN_HOOK (_hurd_proc_subinit, ());
- if (_hurd_exec_flags & EXEC_TRACED)
+ /* XXX This code should probably be removed entirely at some point. This
+ conditional should make it reasonably usable with old gdb's for a
+ while. Eventually it probably makes most sense for the exec server to
+ mask out EXEC_SIGTRAP so the debugged program is closer to not being
+ able to tell it's being debugged. */
+ if (!__sigisemptyset (&_hurdsig_traced)
+#ifdef EXEC_SIGTRAP
+ && !(_hurd_exec_flags & EXEC_SIGTRAP)
+#endif
+ )
/* This process is "traced", meaning it should stop on signals or exec.
We are all set up now to handle signals. Stop ourselves, to inform
our parent (presumably a debugger) that the exec has completed. */
- __msg_sig_post (_hurd_msgport, SIGTRAP, __mach_task_self ());
+ __msg_sig_post (_hurd_msgport, SIGTRAP, 0, __mach_task_self ());
}
+
+#include <shlib-compat.h>
+versioned_symbol (libc, _hurd_new_proc_init, _hurd_proc_init, GLIBC_2_1);
\f
/* Called when we get a message telling us to change our proc server port. */
/* Tell the proc server where our args and environment are. */
if (err = __proc_set_arg_locations (procserver,
- /* We don't know the ARGV location. */
- (vm_address_t) 0,
+ _hide_arguments ? 0 :
+ (vm_address_t) __libc_argv,
_hide_environment ? 0 :
(vm_address_t) __environ))
return err;
return 0;
}
-\f
-#ifndef PIC
-
-/* Map the page at address zero with no access allowed, so
- dereferencing NULL will fault and no "anywhere" allocations
- (e.g. the out of line memory containing the argument strings)
- can be assigned address zero, which C says is not a valid pointer.
-
- When dynamically linked, this will be done by the dynamic linker
- before we run. */
-
-static void map0 (void) __attribute__ ((unused));
-text_set_element (_hurd_preinit_hook, map0);
-
-static void
-map0 (void)
-{
- vm_address_t addr = 0;
- __vm_map (__mach_task_self (),
- &addr, __vm_page_size, 0, 0, MACH_PORT_NULL, 0, 1,
- VM_PROT_NONE, VM_PROT_NONE, VM_INHERIT_COPY);
-}
-
-#endif