svn commit: branches/uClibc-nptl: include libc/inet libc/sysdeps/linux/com etc...

sjhill at uclibc.org sjhill at uclibc.org
Sun Jan 15 05:30:50 UTC 2006


Author: sjhill
Date: 2006-01-14 21:30:47 -0800 (Sat, 14 Jan 2006)
New Revision: 13340

Log:
Clean up '_res' such that it will now work for, NPTL, linuxthreads and
even no threads. Fix 'pthread_atfork' function and clean up duplicate
of '__set_errno' that is not needed.


Removed:
   branches/uClibc-nptl/libpthread/nptl/old_pthread_atfork.c

Modified:
   branches/uClibc-nptl/include/resolv.h
   branches/uClibc-nptl/libc/inet/resolv.c
   branches/uClibc-nptl/libc/sysdeps/linux/common/Makefile.in
   branches/uClibc-nptl/libc/sysdeps/linux/mips/bits/syscalls.h
   branches/uClibc-nptl/libpthread/nptl/Makefile.in
   branches/uClibc-nptl/libpthread/nptl/pthread_atfork.c
   branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/register-atfork.c


Changeset:
Modified: branches/uClibc-nptl/include/resolv.h
===================================================================
--- branches/uClibc-nptl/include/resolv.h	2006-01-15 04:12:27 UTC (rev 13339)
+++ branches/uClibc-nptl/include/resolv.h	2006-01-15 05:30:47 UTC (rev 13340)
@@ -398,7 +398,7 @@
 #    endif
 #   else
 #    undef _res
-extern struct __res_state _res;
+#    define _res (*__resp)
 #   endif /* __UCLIBC_HAS_THREADS_NATIVE__ */
 #  endif /* __UCLIBC_HAS_THREADS__ */
 # endif /* _LIBC */

Modified: branches/uClibc-nptl/libc/inet/resolv.c
===================================================================
--- branches/uClibc-nptl/libc/inet/resolv.c	2006-01-15 04:12:27 UTC (rev 13339)
+++ branches/uClibc-nptl/libc/inet/resolv.c	2006-01-15 05:30:47 UTC (rev 13340)
@@ -1191,15 +1191,17 @@
 /* This needs to be after the use of _res in res_init, above.  */
 #undef _res
 
+#ifndef __UCLIBC_HAS_THREADS__
 /* The resolver state for use by single-threaded programs.
    This differs from plain `struct __res_state _res;' in that it doesn't
    create a common definition, but a plain symbol that resides in .bss,
    which can have an alias.  */
 struct __res_state _res __attribute__((section (".bss")));
+#else
+struct __res_state _res __attribute__((section (".bss"))) attribute_hidden;
 
-#if defined __UCLIBC_HAS_THREADS_NATIVE__ \
-	    && (!defined NOT_IN_libc || defined IS_IN_libpthread)
-# undef __resp
+# if defined __UCLIBC_HAS_THREADS_NATIVE__
+#  undef __resp
 __thread struct __res_state *__resp = &_res; 
 /*
  * FIXME: Add usage of hidden attribute for this when used in the shared
@@ -1208,13 +1210,22 @@
  */
 extern __thread struct __res_state *__libc_resp
 	__attribute__ ((alias ("__resp")));
+# else
+#  undef __resp
+struct __res_state *__resp = &_res; 
+# endif
 #endif
 
 #endif
 
 #ifdef L_res_state
-# if defined __UCLIBC_HAS_THREADS_NATIVE__ \
-	    && (!defined NOT_IN_libc || defined IS_IN_libpthread)
+# if defined __UCLIBC_HAS_THREADS__
+struct __res_state *
+__res_state (void)
+{
+	return __resp;
+}
+# else
 #  undef _res
 extern struct __res_state _res;
 
@@ -1225,13 +1236,6 @@
 {
 	return &_res;
 }
-
-# else
-struct __res_state *
-__res_state (void)
-{
-	return __resp;
-}
 # endif
 
 #endif

Modified: branches/uClibc-nptl/libc/sysdeps/linux/common/Makefile.in
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/common/Makefile.in	2006-01-15 04:12:27 UTC (rev 13339)
+++ branches/uClibc-nptl/libc/sysdeps/linux/common/Makefile.in	2006-01-15 05:30:47 UTC (rev 13340)
@@ -14,10 +14,6 @@
 CSRC:=$(filter-out sbrk.c,$(CSRC))
 endif
 
-ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-CSRC:=$(filter-out fork.c,$(CSRC))
-endif
-
 COMMON_SSP:=ssp.c ssp-local.c
 
 # full list
@@ -34,7 +30,7 @@
 endif
 
 ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-CSRC:=$(filter-out getpid.c raise.c,$(CSRC))
+CSRC:=$(filter-out fork.c getpid.c raise.c,$(CSRC))
 endif
 
 # fails for some reason

Modified: branches/uClibc-nptl/libc/sysdeps/linux/mips/bits/syscalls.h
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/mips/bits/syscalls.h	2006-01-15 04:12:27 UTC (rev 13339)
+++ branches/uClibc-nptl/libc/sysdeps/linux/mips/bits/syscalls.h	2006-01-15 05:30:47 UTC (rev 13340)
@@ -9,13 +9,6 @@
  * programs.  */
 #include <bits/sysnum.h>
 
-#ifndef __set_errno
-# ifdef __UCLIBC_HAS_THREADS__
-#  define __set_errno(val) (*__errno_location ()) = (val)
-# else
-#  define __set_errno(val) (errno = (val))
-# endif
-#endif
 #ifndef SYS_ify
 # define SYS_ify(syscall_name)  (__NR_##syscall_name)
 #endif

Modified: branches/uClibc-nptl/libpthread/nptl/Makefile.in
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/Makefile.in	2006-01-15 04:12:27 UTC (rev 13339)
+++ branches/uClibc-nptl/libpthread/nptl/Makefile.in	2006-01-15 05:30:47 UTC (rev 13340)
@@ -64,7 +64,7 @@
 		      pthread_cancel pthread_testcancel \
 		      pthread_setcancelstate pthread_setcanceltype \
 		      pthread_once \
-		      old_pthread_atfork pthread_atfork \
+		      pthread_atfork \
 		      pthread_getcpuclockid \
 		      pthread_clock_gettime pthread_clock_settime \
 		      sem_init sem_destroy \
@@ -94,7 +94,6 @@
 		      cleanup_routine unwind-forcedunwind
 
 libpthread-shared-only-routines = version pt-allocrtsig unwind-forcedunwind
-libpthread-static-only-routines = pthread_atfork
 
 CFLAGS-pthread_atfork.c = -DNOT_IN_libc
 
@@ -234,8 +233,7 @@
 	       $(libpthread-routines)))
 libpthread_so_SRC = $(patsubst %, $(libpthread_DIR)/%.c,		\
 		$(filter-out $(libpthread-os-routines) \
-	       $(libpthread-misc-routines)				 \
-	       $(libpthread-static-only-routines), $(libpthread-routines)))
+	       $(libpthread-misc-routines), $(libpthread-routines)))
 
 libc-a-y += $(patsubst %.c, $(libpthread_OUT)/%.o, alloca_cutoff.c	\
 	    forward.c libc-cancellation.c)

Deleted: branches/uClibc-nptl/libpthread/nptl/old_pthread_atfork.c
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/old_pthread_atfork.c	2006-01-15 04:12:27 UTC (rev 13339)
+++ branches/uClibc-nptl/libpthread/nptl/old_pthread_atfork.c	2006-01-15 05:30:47 UTC (rev 13340)
@@ -1,27 +0,0 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper at redhat.com>, 2002.
-
-   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 <shlib-compat.h>
-
-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_3)
-# define __pthread_atfork __dyn_pthread_atfork
-# include "pthread_atfork.c"
-# undef __pthread_atfork
-compat_symbol (libpthread, __dyn_pthread_atfork, pthread_atfork, GLIBC_2_0);
-#endif

Modified: branches/uClibc-nptl/libpthread/nptl/pthread_atfork.c
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/pthread_atfork.c	2006-01-15 04:12:27 UTC (rev 13339)
+++ branches/uClibc-nptl/libpthread/nptl/pthread_atfork.c	2006-01-15 05:30:47 UTC (rev 13340)
@@ -41,13 +41,6 @@
 extern void *__dso_handle __attribute__ ((__weak__));
 
 
-/* Hide the symbol so that no definition but the one locally in the
-   executable or DSO is used.  */
-int
-#ifndef __pthread_atfork
-/* Don't mark the compatibility function as hidden.  */
-attribute_hidden
-#endif
 __pthread_atfork (prepare, parent, child)
      void (*prepare) (void);
      void (*parent) (void);
@@ -56,8 +49,4 @@
   return __register_atfork (prepare, parent, child,
 			    &__dso_handle == NULL ? NULL : __dso_handle);
 }
-#ifndef __pthread_atfork
-extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
-			   void (*child) (void)) attribute_hidden;
 strong_alias (__pthread_atfork, pthread_atfork)
-#endif

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	2006-01-15 04:12:27 UTC (rev 13339)
+++ branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/register-atfork.c	2006-01-15 05:30:47 UTC (rev 13340)
@@ -106,32 +106,3 @@
 
   return newp == NULL ? ENOMEM : 0;
 }
-hidden_def (__register_atfork)
-
-
-#ifndef __UCLIBC__
-libc_freeres_fn (free_mem)
-{
-  /* Get the lock to not conflict with running forks.  */
-  lll_lock (__fork_lock);
-
-  /* No more fork handlers.  */
-  __fork_handlers = NULL;
-
-  /* Free eventually alloated memory blocks for the object pool.  */
-  struct fork_handler_pool *runp = fork_handler_pool.next;
-
-  memset (&fork_handler_pool, '\0', sizeof (fork_handler_pool));
-
-  /* Release the lock.  */
-  lll_unlock (__fork_lock);
-
-  /* We can free the memory after releasing the lock.  */
-  while (runp != NULL)
-    {
-      struct fork_handler_pool *oldp = runp;
-      runp = runp->next;
-      free (oldp);
-    }
-}
-#endif




More information about the uClibc-cvs mailing list