]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - hurd/hurdinit.c
hurd: allow poll() array bigger than FD_SETSIZE
[thirdparty/glibc.git] / hurd / hurdinit.c
index 425b9b717c9dcd1da0a440854ccbfc40f671ce1e..43d49aa9b097db54aac755dcaa06e7b640b6b6c6 100644 (file)
@@ -1,20 +1,19 @@
-/* Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* 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.
+   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.
+   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., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, 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>
@@ -31,19 +30,27 @@ 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.
 
@@ -82,7 +89,7 @@ _hurd_init (int flags, char **argv,
 
   /* Tell the proc server we exist, if it does.  */
   if (portarray[INIT_PORT_PROC] != MACH_PORT_NULL)
-    _hurd_proc_init (argv);
+    _hurd_new_proc_init (argv, intarray, intarraysize);
 
   /* All done with init ints and ports.  */
   __vm_deallocate (__mach_task_self (),
@@ -118,14 +125,15 @@ DEFINE_HOOK (_hurd_proc_subinit, (void));
    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.  */
@@ -153,12 +161,24 @@ _hurd_proc_init (char **argv)
      here, like _hurd_pid, are already initialized.  */
   RUN_HOOK (_hurd_proc_subinit, ());
 
-  if (_hurdsig_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, 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.  */