[Glibc-bsd-commits] r2611 - trunk/glibc-ports/kfreebsd

Petr Salinger ps-guest at alioth.debian.org
Mon Jun 29 12:46:56 UTC 2009


Author: ps-guest
Date: 2009-06-29 12:46:55 +0000 (Mon, 29 Jun 2009)
New Revision: 2611

Modified:
   trunk/glibc-ports/kfreebsd/init-first.c
Log:
init-first.c - sync with Linux version, directly use __syscall_sigaction() instead of signal()



Modified: trunk/glibc-ports/kfreebsd/init-first.c
===================================================================
--- trunk/glibc-ports/kfreebsd/init-first.c	2009-06-26 15:04:06 UTC (rev 2610)
+++ trunk/glibc-ports/kfreebsd/init-first.c	2009-06-29 12:46:55 UTC (rev 2611)
@@ -1,5 +1,5 @@
-/* Initialization code run first thing by the ELF startup code.  Linux version.
-   Copyright (C) 1995-1999,2000,01,02,03,2004 Free Software Foundation, Inc.
+/* Initialization code run first thing by the ELF startup code.
+   Copyright (C) 1995-2004, 2005, 2007 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
@@ -30,8 +30,8 @@
 
 #include <ldsodefs.h>
 
-/* The function is called from assembly stubs the compiler can't see.  */
-static void init (int, char **, char **) __attribute__ ((used));
+extern int __syscall_sigaction (int __sig,  const struct sigaction *__act, struct sigaction *__oact) __THROW;
+libc_hidden_proto (__syscall_sigaction)
 
 /* Set nonzero if we have to be prepared for more then one libc being
    used in the process.  Safe assumption if initializer never runs.  */
@@ -43,9 +43,18 @@
 char **__libc_argv attribute_hidden;
 
 
-static void
-init (int argc, char **argv, char **envp)
+void
+__libc_init_first (int argc, char **argv, char **envp)
 {
+#ifdef SHARED
+  /* For DSOs we do not need __libc_init_first but instead _init.  */
+}
+
+void
+attribute_hidden
+_init (int argc, char **argv, char **envp)
+{
+#endif
 #ifdef USE_NONOPTION_FLAGS
   extern void __getopt_clean_environment (char **);
 #endif
@@ -72,7 +81,15 @@
      made, the program is terminated. As we want to be able to detect
      missing syscalls and provide a fallback code, we ignore the SIGSYS
      signal. */
-  signal(SIGSYS, SIG_IGN);
+  {
+    struct sigaction act;
+    
+    act.sa_handler = SIG_IGN;
+    __sigemptyset (&act.sa_mask);
+    act.sa_flags = 0;
+    
+    INLINE_SYSCALL (sigaction, 3, SIGSYS, &act, NULL); 
+  }  
 
   /* Save the command-line arguments.  */
   __libc_argc = argc;
@@ -87,6 +104,10 @@
   _dl_non_dynamic_init ();
 #endif
 
+#ifdef VDSO_SETUP
+  VDSO_SETUP ();
+#endif
+
   __init_misc (argc, argv, envp);
 
 #ifdef USE_NONOPTION_FLAGS
@@ -99,28 +120,7 @@
 #endif
 }
 
-#ifdef SHARED
 
-strong_alias (init, _init);
-
-extern void __libc_init_first (void);
-
-void
-__libc_init_first (void)
-{
-}
-
-#else
-extern void __libc_init_first (int argc, char **argv, char **envp);
-
-void
-__libc_init_first (int argc, char **argv, char **envp)
-{
-  init (argc, argv, envp);
-}
-#endif
-
-
 /* This function is defined here so that if this file ever gets into
    ld.so we will get a link error.  Having this file silently included
    in ld.so causes disaster, because the _init definition above will




More information about the Glibc-bsd-commits mailing list