[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pthread_atfork()



Thomas Bushnell BSG, le Thu 27 Dec 2007 18:06:39 -0800, a écrit :
> > Now, that said, we'd have to modify libc's <gnu/stubs.h> to also include
> > a <gnu/stubs-pthread.h> provided by the hurd's libpthread.
> 
> Yes, certainly, or at least a general Hurdish one or something.

Actually, only libpthread provides standard functions that may be stubs.

So, something like this?

Samuel

Index: config.make.in
===================================================================
RCS file: /cvsroot/hurd/hurd/config.make.in,v
retrieving revision 1.19
diff -u -p -r1.19 config.make.in
--- config.make.in	7 Nov 2007 13:07:52 -0000	1.19
+++ config.make.in	1 Jan 2008 04:07:44 -0000
@@ -44,6 +44,7 @@ RANLIB = @RANLIB@
 MIG = @MIG@
 MIGCOM = $(MIG) -cc cat - /dev/null
 AWK = @AWK@
+OBJDUMP = @OBJDUMP@
 
 # Compilation flags.  Append these to the definitions already made by
 # the specific Makefile.
Index: configure.in
===================================================================
RCS file: /cvsroot/hurd/hurd/configure.in,v
retrieving revision 1.37
diff -u -p -r1.37 configure.in
--- configure.in	7 Nov 2007 13:07:52 -0000	1.37
+++ configure.in	1 Jan 2008 04:07:44 -0000
@@ -75,6 +75,7 @@ AC_SUBST(enable_static_progs)
 
 AC_PROG_INSTALL
 AC_PROG_AWK
+AC_CHECK_PROG(OBJDUMP, objdump)
 
 AC_PROG_CC
 # Require GCC.
Index: libpthread/Makefile
===================================================================
RCS file: /cvsroot/hurd/hurd/libpthread/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- libpthread/Makefile	19 Nov 2007 17:37:02 -0000	1.7
+++ libpthread/Makefile	1 Jan 2008 04:07:45 -0000
@@ -180,12 +180,12 @@ CPPFLAGS += \
 	  -imacros $(srcdir)/not-in-libc.h
 
 
-install: install-headers $(libdir)/libpthread2.a $(libdir)/libpthread2_pic.a
+install: install-headers $(libdir)/libpthread2.a $(libdir)/libpthread2_pic.a $(includedir)/gnu/stubs-pthread.h
 install-headers: $(addprefix $(includedir)/, $(sysdeps_headers))
 
 # XXX: If $(libdir)/libpthread2.a is installed and
 # $(libdir)/libpthread is not, we can have some issues.
-.PHONY: $(libdir)/libpthread.a $(libdir)/libpthread_pic.a
+.PHONY: $(libdir)/libpthread.a $(libdir)/libpthread_pic.a $(includedir)/gnu/stubs-pthread.h
 
 # XXX: These rules are a hack.  But it is better than messing with
 # ../Makeconf at the moment.  Note that the linker scripts
@@ -199,6 +199,15 @@ $(libdir)/libpthread2_pic.a: $(libdir)/l
 	mv $< $@
 	$(INSTALL_DATA) $(srcdir)/libpthread_pic.a $<
 
+$(includedir)/gnu/stubs-pthread.h: $(OBJS)
+	mkdir -p $(includedir)/gnu
+	$(OBJDUMP) -h $^ | \
+	$(AWK) '/\.gnu\.glibc-stub\./ { \
+		  sub(/\.gnu\.glibc-stub\./, "", $$2); \
+		  stubs[$$2] = 1; } \
+		END { for (s in stubs) print "#define __stub_" s }' > $@T
+	mv -f $@T $@
+
 .PHONY: $(addprefix $(includedir)/, $(sysdeps_headers))
 
 $(addprefix $(includedir)/, $(sysdeps_headers)):
Index: libpthread/include/libc-symbols.h
===================================================================
RCS file: /cvsroot/hurd/hurd/libpthread/include/libc-symbols.h,v
retrieving revision 1.1
diff -u -p -r1.1 libc-symbols.h
--- libpthread/include/libc-symbols.h	10 Oct 2002 23:05:06 -0000	1.1
+++ libpthread/include/libc-symbols.h	1 Jan 2008 04:07:45 -0000
@@ -60,6 +60,7 @@
 #define HAVE_ELF
 #define HAVE_SECTION_QUOTES
 #define HAVE_VISIBILITY_ATTRIBUTE
+#define HAVE_ASM_PREVIOUS_DIRECTIVE
 // #define SHARED
 
 /* The symbols in all the user (non-_) macros are C symbols.
@@ -250,6 +251,7 @@
 
 /* A canned warning for sysdeps/stub functions.  */
 #define	stub_warning(name) \
+  __make_section_unallocated (".gnu.glibc-stub." #name) \
   link_warning (name, \
 		"warning: " #name " is not implemented and will always fail")
 
Index: libpthread/sysdeps/generic/pt-atfork.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpthread/sysdeps/generic/pt-atfork.c,v
retrieving revision 1.1
diff -u -p -r1.1 pt-atfork.c
--- libpthread/sysdeps/generic/pt-atfork.c	10 Oct 2002 23:05:06 -0000	1.1
+++ libpthread/sysdeps/generic/pt-atfork.c	1 Jan 2008 04:07:46 -0000
@@ -27,3 +27,5 @@ pthread_atfork (void (*prepare) (void),
 {
   return ENOSYS;
 }
+
+stub_warning (pthread_atfork)
Index: libpthread/sysdeps/generic/pt-getcpuclockid.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpthread/sysdeps/generic/pt-getcpuclockid.c,v
retrieving revision 1.1
diff -u -p -r1.1 pt-getcpuclockid.c
--- libpthread/sysdeps/generic/pt-getcpuclockid.c	10 Oct 2002 23:05:06 -0000	1.1
+++ libpthread/sysdeps/generic/pt-getcpuclockid.c	1 Jan 2008 04:07:46 -0000
@@ -30,5 +30,6 @@ pthread_getcpuclockid (pthread_t thread,
   return 0;
 #else
   return ENOSYS;
+stub_warning (pthread_getcpuclockid)
 #endif
 }
Index: libpthread/sysdeps/generic/pt-getschedparam.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpthread/sysdeps/generic/pt-getschedparam.c,v
retrieving revision 1.1
diff -u -p -r1.1 pt-getschedparam.c
--- libpthread/sysdeps/generic/pt-getschedparam.c	10 Oct 2002 23:05:06 -0000	1.1
+++ libpthread/sysdeps/generic/pt-getschedparam.c	1 Jan 2008 04:07:46 -0000
@@ -26,3 +26,5 @@ pthread_getschedparam (pthread_t thread,
 {
   return ENOSYS;
 }
+
+stub_warning (pthread_getschedparam)
Index: libpthread/sysdeps/generic/pt-key-create.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpthread/sysdeps/generic/pt-key-create.c,v
retrieving revision 1.1
diff -u -p -r1.1 pt-key-create.c
--- libpthread/sysdeps/generic/pt-key-create.c	10 Oct 2002 23:05:06 -0000	1.1
+++ libpthread/sysdeps/generic/pt-key-create.c	1 Jan 2008 04:07:46 -0000
@@ -25,3 +25,5 @@ pthread_key_create (pthread_key_t *key, 
 {
   return ENOSYS;
 }
+
+stub_warning (pthread_key_create)
Index: libpthread/sysdeps/generic/pt-key-delete.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpthread/sysdeps/generic/pt-key-delete.c,v
retrieving revision 1.2
diff -u -p -r1.2 pt-key-delete.c
--- libpthread/sysdeps/generic/pt-key-delete.c	2 Nov 2002 23:41:51 -0000	1.2
+++ libpthread/sysdeps/generic/pt-key-delete.c	1 Jan 2008 04:07:46 -0000
@@ -25,3 +25,5 @@ pthread_key_delete (pthread_key_t key)
 {
   return ENOSYS;
 }
+
+stub_warning (pthread_key_delete)
Index: libpthread/sysdeps/generic/pt-mutex-getprioceiling.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpthread/sysdeps/generic/pt-mutex-getprioceiling.c,v
retrieving revision 1.1
diff -u -p -r1.1 pt-mutex-getprioceiling.c
--- libpthread/sysdeps/generic/pt-mutex-getprioceiling.c	10 Oct 2002 23:05:06 -0000	1.1
+++ libpthread/sysdeps/generic/pt-mutex-getprioceiling.c	1 Jan 2008 04:07:46 -0000
@@ -26,3 +26,5 @@ pthread_mutex_getprioceiling (const pthr
 {
   return ENOSYS;
 }
+
+stub_warning (pthread_mutex_getprioceiling)
Index: libpthread/sysdeps/generic/pt-mutex-setprioceiling.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpthread/sysdeps/generic/pt-mutex-setprioceiling.c,v
retrieving revision 1.1
diff -u -p -r1.1 pt-mutex-setprioceiling.c
--- libpthread/sysdeps/generic/pt-mutex-setprioceiling.c	10 Oct 2002 23:05:06 -0000	1.1
+++ libpthread/sysdeps/generic/pt-mutex-setprioceiling.c	1 Jan 2008 04:07:46 -0000
@@ -26,3 +26,5 @@ pthread_mutex_setprioceiling (pthread_mu
 {
   return ENOSYS;
 }
+
+stub_warning (pthread_mutex_setprioceiling)
Index: libpthread/sysdeps/generic/pt-mutexattr-getprioceiling.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpthread/sysdeps/generic/pt-mutexattr-getprioceiling.c,v
retrieving revision 1.1
diff -u -p -r1.1 pt-mutexattr-getprioceiling.c
--- libpthread/sysdeps/generic/pt-mutexattr-getprioceiling.c	10 Oct 2002 23:05:06 -0000	1.1
+++ libpthread/sysdeps/generic/pt-mutexattr-getprioceiling.c	1 Jan 2008 04:07:46 -0000
@@ -26,3 +26,5 @@ pthread_mutexattr_getprioceiling (const 
 {
   return ENOSYS;
 }
+
+stub_warning (pthread_mutexattr_getprioceiling)
Index: libpthread/sysdeps/generic/pt-mutexattr-setprioceiling.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpthread/sysdeps/generic/pt-mutexattr-setprioceiling.c,v
retrieving revision 1.1
diff -u -p -r1.1 pt-mutexattr-setprioceiling.c
--- libpthread/sysdeps/generic/pt-mutexattr-setprioceiling.c	10 Oct 2002 23:05:06 -0000	1.1
+++ libpthread/sysdeps/generic/pt-mutexattr-setprioceiling.c	1 Jan 2008 04:07:46 -0000
@@ -26,3 +26,5 @@ pthread_mutexattr_setprioceiling (pthrea
 {
   return ENOSYS;
 }
+
+stub_warning (pthread_mutexattr_setprioceiling)
Index: libpthread/sysdeps/generic/pt-setschedparam.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpthread/sysdeps/generic/pt-setschedparam.c,v
retrieving revision 1.2
diff -u -p -r1.2 pt-setschedparam.c
--- libpthread/sysdeps/generic/pt-setschedparam.c	20 Apr 2005 15:26:52 -0000	1.2
+++ libpthread/sysdeps/generic/pt-setschedparam.c	1 Jan 2008 04:07:46 -0000
@@ -26,3 +26,5 @@ pthread_setschedparam (pthread_t thread,
 {
   return ENOSYS;
 }
+
+stub_warning (pthread_setschedparam)
Index: libpthread/sysdeps/generic/pt-setschedprio.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpthread/sysdeps/generic/pt-setschedprio.c,v
retrieving revision 1.1
diff -u -p -r1.1 pt-setschedprio.c
--- libpthread/sysdeps/generic/pt-setschedprio.c	10 Oct 2002 23:05:06 -0000	1.1
+++ libpthread/sysdeps/generic/pt-setschedprio.c	1 Jan 2008 04:07:46 -0000
@@ -25,3 +25,5 @@ pthread_setschedprio (pthread_t thread, 
 {
   return ENOSYS;
 }
+
+stub_warning (pthread_setschedprio)


Reply to: