svn commit: branches/uClibc-nptl: libc/stdio libc/stdlib/malloc-standard l etc...

sjhill at uclibc.org sjhill at uclibc.org
Wed Nov 16 03:00:39 UTC 2005


Author: sjhill
Date: 2005-11-15 19:00:38 -0800 (Tue, 15 Nov 2005)
New Revision: 12275

Log:
Remove '__libc_fatal' function and usage of it. Remove and disable 'freeres' code having to do with internal library memory usage and GDB. uClibc homey don't play that.


Removed:
   branches/uClibc-nptl/libc/stdio/fatal.c
   branches/uClibc-nptl/libc/stdlib/malloc-standard/thread-freeres.c

Modified:
   branches/uClibc-nptl/libc/stdio/Makefile
   branches/uClibc-nptl/libc/stdlib/malloc-standard/Makefile
   branches/uClibc-nptl/libpthread/nptl/compat/libc-internal.h
   branches/uClibc-nptl/libpthread/nptl/compat/libc-symbols.h
   branches/uClibc-nptl/libpthread/nptl/pthread_create.c
   branches/uClibc-nptl/libpthread/nptl/sysdeps/generic/libc-tls.c
   branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c
   branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/unwind-resume.c
   branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/register-atfork.c


Changeset:
Modified: branches/uClibc-nptl/libc/stdio/Makefile
===================================================================
--- branches/uClibc-nptl/libc/stdio/Makefile	2005-11-16 02:53:18 UTC (rev 12274)
+++ branches/uClibc-nptl/libc/stdio/Makefile	2005-11-16 03:00:38 UTC (rev 12275)
@@ -59,9 +59,6 @@
 
 # pthread functions
 CSRC += flockfile.c ftrylockfile.c funlockfile.c
-ifeq ($(strip $(UCLIBC_HAS_THREADS_NATIVE)),y)
-CSRC += fatal.c
-endif
 
 # Functions with unlocked versions
 CUSRC = clearerr.c feof.c ferror.c fflush.c fgetc.c fgets.c fileno.c \

Deleted: branches/uClibc-nptl/libc/stdio/fatal.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/fatal.c	2005-11-16 02:53:18 UTC (rev 12274)
+++ branches/uClibc-nptl/libc/stdio/fatal.c	2005-11-16 03:00:38 UTC (rev 12275)
@@ -1,196 +0,0 @@
-/* Copyright (C) 1993-1995,1997,2000,2002-2005 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 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* TODO: Implement '__libc_message' properly. */
-#if 0
-#include <errno.h>
-#include <fcntl.h>
-#include <paths.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysdep.h>
-#include <unistd.h>
-#include <sys/syslog.h>
-#include <execinfo.h>
-
-/* Abort with an error message.  */
-#include <not-cancel.h>
-
-#ifdef FATAL_PREPARE_INCLUDE
-#include FATAL_PREPARE_INCLUDE
-#endif
-
-struct str_list
-{
-  const char *str;
-  size_t len;
-  struct str_list *next;
-};
-
-
-/* Abort with an error message.  */
-void
-__libc_message (int do_abort, const char *fmt, ...)
-{
-  va_list ap;
-  va_list ap_copy;
-  int fd = -1;
-
-  va_start (ap, fmt);
-  va_copy (ap_copy, ap);
-
-#ifdef FATAL_PREPARE
-  FATAL_PREPARE;
-#endif
-
-  /* Open a descriptor for /dev/tty unless the user explicitly
-     requests errors on standard error.  */
-  const char *on_2 = __secure_getenv ("LIBC_FATAL_STDERR_");
-  if (on_2 == NULL || *on_2 == '\0')
-    fd = open_not_cancel_2 (_PATH_TTY, O_RDWR | O_NOCTTY | O_NDELAY);
-
-  if (fd == -1)
-    fd = STDERR_FILENO;
-
-  struct str_list *list = NULL;
-  int nlist = 0;
-
-  const char *cp = fmt;
-  while (*cp != '\0')
-    {
-      /* Find the next "%s" or the end of the string.  */
-      const char *next = cp;
-      while (next[0] != '%' || next[1] != 's')
-	{
-	  next = __strchrnul (next + 1, '%');
-
-	  if (next[0] == '\0')
-	    break;
-	}
-
-      /* Determine what to print.  */
-      const char *str;
-      size_t len;
-      if (cp[0] == '%' && cp[1] == 's')
-	{
-	  str = va_arg (ap, const char *);
-	  len = strlen (str);
-	  cp += 2;
-	}
-      else
-	{
-	  str = cp;
-	  len = next - cp;
-	  cp = next;
-	}
-
-      struct str_list *newp = alloca (sizeof (struct str_list));
-      newp->str = str;
-      newp->len = len;
-      newp->next = list;
-      list = newp;
-      ++nlist;
-    }
-
-  bool written = false;
-  if (nlist > 0)
-    {
-      struct iovec *iov = alloca (nlist * sizeof (struct iovec));
-      ssize_t total = 0;
-
-      for (int cnt = nlist - 1; cnt >= 0; --cnt)
-	{
-	  iov[cnt].iov_base = (void *) list->str;
-	  iov[cnt].iov_len = list->len;
-	  total += list->len;
-	  list = list->next;
-	}
-
-      INTERNAL_SYSCALL_DECL (err);
-      ssize_t cnt;
-      do
-	cnt = INTERNAL_SYSCALL (writev, err, 3, fd, iov, nlist);
-      while (INTERNAL_SYSCALL_ERROR_P (cnt, err)
-	     && INTERNAL_SYSCALL_ERRNO (cnt, err) == EINTR);
-
-      if (cnt == total)
-	written = true;
-    }
-
-  va_end (ap);
-
-  /* If we  had no success writing the message, use syslog.  */
-  if (! written)
-    vsyslog (LOG_ERR, fmt, ap_copy);
-
-  va_end (ap_copy);
-
-  if (do_abort)
-    {
-      if (do_abort > 1 && written)
-	{
-	  void *addrs[64];
-#define naddrs (sizeof (addrs) / sizeof (addrs[0]))
-	  int n = __backtrace (addrs, naddrs);
-	  if (n > 2)
-	    {
-#define strnsize(str) str, strlen (str)
-#define writestr(str) write_not_cancel (fd, str)
-	      writestr (strnsize ("======= Backtrace: =========\n"));
-	      __backtrace_symbols_fd (addrs + 1, n - 1, fd);
-
-	      writestr (strnsize ("======= Memory map: ========\n"));
-	      int fd2 = open_not_cancel_2 ("/proc/self/maps", O_RDONLY);
-	      char buf[1024];
-	      ssize_t n2;
-	      while ((n2 = read_not_cancel (fd2, buf, sizeof (buf))) > 0)
-		if (write_not_cancel (fd, buf, n2) != n2)
-		  break;
-	      close_not_cancel_no_status (fd2);
-	    }
-	}
-
-      /* Terminate the process.  */
-      abort ();
-    }
-}
-
-
-void
-__libc_fatal (message)
-     const char *message;
-{
-  /* The loop is added only to keep gcc happy.  */
-  while (1)
-    __libc_message (1, "%s", message);
-}
-libc_hidden_def (__libc_fatal)
-#else
-#include <stdlib.h>
-void
-__libc_fatal (message)
-     const char *message;
-{
-  /* The loop is added only to keep gcc happy.  */
-  while (1)
-    abort ();
-}
-#endif

Modified: branches/uClibc-nptl/libc/stdlib/malloc-standard/Makefile
===================================================================
--- branches/uClibc-nptl/libc/stdlib/malloc-standard/Makefile	2005-11-16 02:53:18 UTC (rev 12274)
+++ branches/uClibc-nptl/libc/stdlib/malloc-standard/Makefile	2005-11-16 03:00:38 UTC (rev 12275)
@@ -39,10 +39,7 @@
 
 ifeq ($(UCLIBC_HAS_THREADS),y)
 CFLAGS += $(PTINC)
-ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-CSRC += thread-freeres.c
 endif
-endif
 
 OBJ_LIST=../../obj.stdlib.malloc-standard
 

Deleted: branches/uClibc-nptl/libc/stdlib/malloc-standard/thread-freeres.c
===================================================================
--- branches/uClibc-nptl/libc/stdlib/malloc-standard/thread-freeres.c	2005-11-16 02:53:18 UTC (rev 12274)
+++ branches/uClibc-nptl/libc/stdlib/malloc-standard/thread-freeres.c	2005-11-16 03:00:38 UTC (rev 12275)
@@ -1,60 +0,0 @@
-/* Free resources stored in thread-local variables on thread exit.
-   Copyright (C) 2003 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 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-#include <libc-symbols.h>
-
-/* Define a hook variable called NAME.  Functions put on this hook take
-   arguments described by PROTO.  Use `text_set_element (NAME, FUNCTION)'
-   from gnu-stabs.h to add a function to the hook.  */
-
-# define DEFINE_HOOK(NAME, PROTO)               \
-  typedef void __##NAME##_hook_function_t PROTO; \
-  symbol_set_define (NAME)
-
-/* Run all the functions hooked on the set called NAME.
-   Each function is called like this: `function ARGS'.  */
-
-# define RUN_HOOK(NAME, ARGS)						      \
-do {									      \
-  void *const *__unbounded ptr;						      \
-  for (ptr = (void *const *) symbol_set_first_element (NAME);		      \
-       ! symbol_set_end_p (NAME, ptr); ++ptr)				      \
-    (*(__##NAME##_hook_function_t *) *ptr) ARGS;			      \
-} while (0)
-
-
-DEFINE_HOOK (__libc_thread_subfreeres, (void));
-
-/*
- * This needs a lot of work.
- */
-#if 0
-void __attribute__ ((section ("__libc_thread_freeres_fn")))
-__libc_thread_freeres (void)
-{
-  RUN_HOOK (__libc_thread_subfreeres, ());
-}
-#else
-void
-__libc_thread_freeres (void)
-{
-  return;
-}
-#endif

Modified: branches/uClibc-nptl/libpthread/nptl/compat/libc-internal.h
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/compat/libc-internal.h	2005-11-16 02:53:18 UTC (rev 12274)
+++ branches/uClibc-nptl/libpthread/nptl/compat/libc-internal.h	2005-11-16 03:00:38 UTC (rev 12275)
@@ -27,13 +27,6 @@
 /* Get frequency of the system processor.  */
 extern hp_timing_t __get_clockfreq (void);
 
-/* Free all allocated resources.  */
-extern void __libc_freeres (void);
-libc_hidden_proto (__libc_freeres)
-
-/* Free resources stored in thread-local variables on thread exit.  */
-extern void __libc_thread_freeres (void);
-
 /* Define and initialize `__progname' et. al.  */
 extern void __init_misc (int, char **, char **);
 

Modified: branches/uClibc-nptl/libpthread/nptl/compat/libc-symbols.h
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/compat/libc-symbols.h	2005-11-16 02:53:18 UTC (rev 12274)
+++ branches/uClibc-nptl/libpthread/nptl/compat/libc-symbols.h	2005-11-16 03:00:38 UTC (rev 12275)
@@ -50,12 +50,6 @@
 
 #define text_set_element(set, symbol) _elf_set_element(set, symbol)
 #define __sec_comment "\n\t#"
-#define __libc_freeres_fn_section \
-  __attribute__ ((section ("__libc_freeres_fn")))
-#define libc_freeres_fn(name)	\
-  static void name (void) __attribute_used__ __libc_freeres_fn_section;	\
-  text_set_element (__libc_subfreeres, name);				\
-  static void name (void)
 
 #if 0
 # ifndef __ASSEMBLER__
@@ -164,12 +158,6 @@
 # define attribute_tls_model_ie
 #endif
 
-#ifdef HAVE_Z_RELRO
-# define attribute_relro __attribute__ ((section (".data.rel.ro")))
-#else
-# define attribute_relro
-#endif
-
 /* Define SET as a symbol set.  This may be required (it is in a.out) to
    be able to use the set's contents.  */
 #  define symbol_set_define(set)	symbol_set_declare(set)

Modified: branches/uClibc-nptl/libpthread/nptl/pthread_create.c
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/pthread_create.c	2005-11-16 02:53:18 UTC (rev 12274)
+++ branches/uClibc-nptl/libpthread/nptl/pthread_create.c	2005-11-16 03:00:38 UTC (rev 12275)
@@ -26,6 +26,7 @@
 #include <ldsodefs.h>
 #include <atomic.h>
 #include <libc-internal.h>
+#include <resolv.h>
 
 #include <shlib-compat.h>
 
@@ -266,8 +267,10 @@
   /* Run the destructor for the thread-local data.  */
   __nptl_deallocate_tsd ();
 
+#ifndef __UCLIBC__
   /* Clean up any state libc stored in thread-local variables.  */
   __libc_thread_freeres ();
+#endif
 
   /* If this is the last thread we terminate the process now.  We
      do not notify the debugger, it might just irritate it if there
@@ -398,6 +401,11 @@
   pd->schedpolicy = self->schedpolicy;
   pd->schedparam = self->schedparam;
 
+  /* Copy the stack guard canary.  */
+#ifdef THREAD_COPY_STACK_GUARD
+  THREAD_COPY_STACK_GUARD (pd);
+#endif
+
   /* Determine scheduling parameters for the thread.  */
   if (attr != NULL
       && __builtin_expect ((iattr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0, 0)

Modified: branches/uClibc-nptl/libpthread/nptl/sysdeps/generic/libc-tls.c
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/sysdeps/generic/libc-tls.c	2005-11-16 02:53:18 UTC (rev 12274)
+++ branches/uClibc-nptl/libpthread/nptl/sysdeps/generic/libc-tls.c	2005-11-16 03:00:38 UTC (rev 12275)
@@ -200,7 +200,7 @@
 #  error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
 # endif
   if (__builtin_expect (lossage != NULL, 0))
-    __libc_fatal (lossage);
+    abort();
 
   /* We have to create a fake link map which normally would be created
      by the dynamic linker.  It just has to have enough information to

Modified: branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c	2005-11-16 02:53:18 UTC (rev 12274)
+++ branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c	2005-11-16 03:00:38 UTC (rev 12275)
@@ -22,10 +22,8 @@
 #include <unwind.h>
 #include <pthreadP.h>
 
-#ifdef __UCLIBC__
 #define __libc_dlopen(x)	dlopen(x, (RTLD_LOCAL | RTLD_LAZY))
 #define __libc_dlsym		dlsym
-#endif
 
 static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
 static _Unwind_Reason_Code (*libgcc_s_personality)
@@ -56,7 +54,10 @@
       || ARCH_CANCEL_INIT (handle)
 #endif
       )
-    __libc_fatal ("libgcc_s.so.1 must be installed for pthread_cancel to work\n");
+  {
+    printf("libgcc_s.so.1 must be installed for pthread_cancel to work\n");
+    abort();
+  }
 
   libgcc_s_resume = resume;
   libgcc_s_personality = personality;

Modified: branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/unwind-resume.c
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/unwind-resume.c	2005-11-16 02:53:18 UTC (rev 12274)
+++ branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/unwind-resume.c	2005-11-16 03:00:38 UTC (rev 12275)
@@ -37,7 +37,10 @@
   if (handle == NULL
       || (resume = __libc_dlsym (handle, "_Unwind_Resume")) == NULL
       || (personality = __libc_dlsym (handle, "__gcc_personality_v0")) == NULL)
-    __libc_fatal ("libgcc_s.so.1 must be installed for pthread_cancel to work\n");
+  {
+    printf("libgcc_s.so.1 must be installed for pthread_cancel to work\n");
+    abort();
+  }
 
   libgcc_s_resume = resume;
   libgcc_s_personality = personality;

Modified: branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/register-atfork.c
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/register-atfork.c	2005-11-16 02:53:18 UTC (rev 12274)
+++ branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/register-atfork.c	2005-11-16 03:00:38 UTC (rev 12275)
@@ -109,6 +109,7 @@
 libc_hidden_def (__register_atfork)
 
 
+#ifndef __UCLIBC__
 libc_freeres_fn (free_mem)
 {
   /* Get the lock to not conflict with running forks.  */
@@ -133,3 +134,4 @@
       free (oldp);
     }
 }
+#endif




More information about the uClibc-cvs mailing list