[uClibc-cvs] svn commit: branches/uClibc-nptl: libc/sysdeps/linux/common libpthread/npt etc...

sjhill at uclibc.org sjhill at uclibc.org
Thu Aug 11 03:25:34 UTC 2005


Author: sjhill
Date: 2005-08-10 21:25:34 -0600 (Wed, 10 Aug 2005)
New Revision: 11107

Log:
It occurred to me that for the uClibc way of doing things, we should be using the syscall to fork if pthreads is not being used for NPTL, just like we do with the linuxthreads model. There were some name collisions that had to fixed, but things should be sane now. Also, due to complexities of the new thread model and compilation, the 'fork.c' from NPTL has to be compiled in with the C library, even though the code in it is not called until pthreads is linked in either dynamically by the loader or in a static binary. If that all makes sense to you, give yourself a cookie.


Added:
   branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile

Modified:
   branches/uClibc-nptl/libc/sysdeps/linux/common/Makefile
   branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
   branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c


Changeset:
Modified: branches/uClibc-nptl/libc/sysdeps/linux/common/Makefile
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/common/Makefile	2005-08-11 03:20:10 UTC (rev 11106)
+++ branches/uClibc-nptl/libc/sysdeps/linux/common/Makefile	2005-08-11 03:25:34 UTC (rev 11107)
@@ -21,10 +21,6 @@
 
 SRCS  = $(wildcard *.c)
 
-ifeq ($(strip $(PTHREADS_NATIVE)),y)
-SRCS := $(filter-out fork.c,$(SRCS))
-endif
-
 ifeq ($(strip $(EXCLUDE_BRK)),y)
 SRCS := $(filter-out sbrk.c,$(SRCS))
 endif

Modified: branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c	2005-08-11 03:20:10 UTC (rev 11106)
+++ branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c	2005-08-11 03:25:34 UTC (rev 11107)
@@ -59,7 +59,11 @@
 
 
 pid_t
+#ifdef __UCLIBC__
+__libc_fork_nptl (void)
+#else
 __libc_fork (void)
+#endif
 {
   pid_t pid;
   struct used_handler
@@ -231,6 +235,8 @@
 
   return pid;
 }
+#ifndef __UCLIBC__
 weak_alias (__libc_fork, __fork)
 libc_hidden_def (__fork)
 weak_alias (__libc_fork, fork)
+#endif

Added: branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile	2005-08-11 03:20:10 UTC (rev 11106)
+++ branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile	2005-08-11 03:25:34 UTC (rev 11107)
@@ -0,0 +1,91 @@
+# Makefile for uClibc NPTL pthread library (Linux/MIPS)
+#
+# Copyright (C) 2005 Steven J. Hill <sjhill at realitydiluted.com>
+#
+# This program 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.
+#
+# This program 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.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Makefile for uClibc
+
+TOPDIR=../../../../../../../
+include $(TOPDIR)Rules.mak
+include ../../../../../Rules.mak
+
+ASRC-LIBP-ST = pt-vfork.S
+ASRC-LIBP-SH = $(ASRC-LIBP-ST)
+
+CSRC-LIBP-ST = pthread_once.c
+CSRC-LIBP-SH = $(CSRC-LIBP-ST)
+
+CSRC-LIBC-ST = fork.c
+CSRC-LIBC-SH = $(CSRC-LIBC-ST)
+
+AOBJ-LIBP-ST = $(patsubst %.S, %.o, $(ASRC-LIBP-ST))
+AOBJ-LIBP-SH = $(patsubst %.S, %.os, $(ASRC-LIBP-SH))
+COBJ-LIBP-ST = $(patsubst %.c, %.o, $(CSRC-LIBP-ST))
+COBJ-LIBP-SH = $(patsubst %.c, %.os, $(CSRC-LIBP-ST))
+COBJ-LIBC-ST = $(patsubst %.c, %.o, $(CSRC-LIBC-ST))
+COBJ-LIBC-SH = $(patsubst %.c, %.os, $(CSRC-LIBC-SH))
+
+ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
+CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
+endif
+
+ar-target all: $(AOBJ-LIBP-ST) $(AOBJ-LIBP-SH) $(COBJ-LIBP-ST) $(COBJ-LIBP-SH)
+ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
+	$(STRIPTOOL) -X --strip-debug -R .note -R .comment	\
+		$(AOBJ-LIBP-ST) $(AOBJ-LIBP-SH) $(COBJ-LIBP-ST) $(COBJ-LIBP-SH)
+else
+	$(STRIPTOOL) -x -R .note -R .comment			\
+		$(AOBJ-LIBP-ST) $(AOBJ-LIBP-SH) $(COBJ-LIBP-ST) $(COBJ-LIBP-SH)
+endif
+	$(AR) $(ARFLAGS) $(PTDIR)../$(LIBPTHREAD_STATIC_ARCHIVE)	\
+		$(AOBJ-LIBP-ST) $(COBJ-LIBP-ST)
+	$(AR) $(ARFLAGS) $(PTDIR)../$(LIBPTHREAD_SHARED_ARCHIVE)	\
+		$(AOBJ-LIBP-SH) $(COBJ-LIBP-SH)
+
+$(AOBJ-LIBP-ST): %.o : %.S
+	$(CC) $(ASFLAGS-LIBP) -c $< -o $@
+
+$(AOBJ-LIBP-SH): %.os : %.S
+	$(CC) $(ASFLAGS-LIBP) -DSHARED -c $< -o $@
+
+$(COBJ-LIBP-ST): %.o : %.c
+	$(CC) $(CFLAGS-$<) $(CFLAGS-LIBP) -c $< -o $@
+
+$(COBJ-LIBP-SH): %.os : %.c
+	$(CC) $(CFLAGS-$<) $(CFLAGS-LIBP) -DSHARED -c $< -o $@
+
+$(COBJ-LIBC-ST): %.o : %.c
+	$(CC) $(CFLAGS-$<) $(CFLAGS-LIBC) -c $< -o $@
+
+$(COBJ-LIBC-SH): %.os : %.c
+	$(CC) $(CFLAGS-$<) $(CFLAGS-LIBC) -DSHARED -c $< -o $@
+
+objs-pthread-libc: $(COBJ-LIBC-ST) $(COBJ-LIBC-SH)
+ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
+	$(STRIPTOOL) -X --strip-debug -R .note -R .comment	\
+		$(COBJ-LIBC-ST) $(COBJ-LIBC-SH)
+else
+	$(STRIPTOOL) -x -R .note -R .comment			\
+		$(COBJ-LIBC-ST) $(COBJ-LIBC-SH)
+endif
+	@for objfile in $(COBJ-LIBC-ST); do \
+		echo ../libpthread/nptl/sysdeps/unix/sysv/linux/mips/$$objfile >> $(PTCOBJST); \
+	done
+	@for objfile in $(COBJ-LIBC-SH); do \
+		echo ../libpthread/nptl/sysdeps/unix/sysv/linux/mips/$$objfile >> $(PTCOBJSH); \
+	done
+
+clean:
+	$(RM) *.o *.os *~ core

Modified: branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c	2005-08-11 03:20:10 UTC (rev 11106)
+++ branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c	2005-08-11 03:25:34 UTC (rev 11107)
@@ -22,6 +22,10 @@
 pid_t
 __fork (void)
 {
+#ifdef __UCLIBC__
+  return __libc_fork_nptl ();
+#else
   return __libc_fork ();
+#endif
 }
 strong_alias (__fork, fork)




More information about the uClibc-cvs mailing list