This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Fixing pthread_* namespace issues for thrd_* symbols


Hello there.

I have been working on this for a while and finally I guess I have
started to understand how all this works. This patch just sets a few
pthread_* symbols to weak symbols. Please experts take a look at it
and let me know if there is any problem with this.

It's not actually a patch because it's my first contribution but I
already have my copyright assignment form signed and I would like to
know if I need to send it to any of you.

I also don't know if the patch will look good by using gmail client
(the one I'm using now), but for Linux patches I use Evolution, let me
know if the format is correct.

Here is the actual patch, cheers :)



diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 84a7105..2838dcf 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -484,7 +484,9 @@ extern int __pthread_once (pthread_once_t *once_control,
 extern int __pthread_atfork (void (*prepare) (void), void (*parent) (void),
      void (*child) (void));
 extern pthread_t __pthread_self (void);
+extern int __pthread_detach(pthread_t th);
 extern int __pthread_equal (pthread_t thread1, pthread_t thread2);
+extern int __pthread_join (pthread_t threadid, void **thread_return);
 extern int __pthread_kill (pthread_t threadid, int signo);
 extern void __pthread_exit (void *value) __attribute__ ((__noreturn__));
 extern int __pthread_setcanceltype (int type, int *oldtype);
diff --git a/nptl/pthread_detach.c b/nptl/pthread_detach.c
index aa735f6..2221ab9 100644
--- a/nptl/pthread_detach.c
+++ b/nptl/pthread_detach.c
@@ -22,7 +22,7 @@


 int
-pthread_detach (th)
+__pthread_detach (th)
      pthread_t th;
 {
   struct pthread *pd = (struct pthread *) th;
@@ -54,3 +54,5 @@ pthread_detach (th)

   return result;
 }
+
+weak_alias (__pthread_detach, pthread_detach)
diff --git a/nptl/pthread_equal.c b/nptl/pthread_equal.c
index 69f4c1b..2e730df 100644
--- a/nptl/pthread_equal.c
+++ b/nptl/pthread_equal.c
@@ -26,4 +26,4 @@ __pthread_equal (thread1, thread2)
 {
   return thread1 == thread2;
 }
-strong_alias (__pthread_equal, pthread_equal)
+weak_alias (__pthread_equal, pthread_equal)
diff --git a/nptl/pthread_exit.c b/nptl/pthread_exit.c
index a60adbd..9ec8b0d 100644
--- a/nptl/pthread_exit.c
+++ b/nptl/pthread_exit.c
@@ -27,7 +27,7 @@ __pthread_exit (void *value)

   __do_cancel ();
 }
-strong_alias (__pthread_exit, pthread_exit)
+weak_alias (__pthread_exit, pthread_exit)

 /* After a thread terminates, __libc_start_main decrements
    __nptl_nthreads defined in pthread_create.c.  */
diff --git a/nptl/pthread_join.c b/nptl/pthread_join.c
index c841ff9..d454051 100644
--- a/nptl/pthread_join.c
+++ b/nptl/pthread_join.c
@@ -37,7 +37,7 @@ cleanup (void *arg)


 int
-pthread_join (pthread_t threadid, void **thread_return)
+__pthread_join (pthread_t threadid, void **thread_return)
 {
   struct pthread *pd = (struct pthread *) threadid;

@@ -115,3 +115,5 @@ pthread_join (pthread_t threadid, void **thread_return)

   return result;
 }
+
+weak_alias(__pthread_join, pthread_join);
diff --git a/nptl/pthread_self.c b/nptl/pthread_self.c
index d6ba45c..422151e 100644
--- a/nptl/pthread_self.c
+++ b/nptl/pthread_self.c
@@ -25,4 +25,4 @@ __pthread_self (void)
 {
   return (pthread_t) THREAD_SELF;
 }
-strong_alias (__pthread_self, pthread_self)
+weak_alias (__pthread_self, pthread_self)


-- 
Juan Manuel Torres Palma.
Computer Science Student at Universidad de Granada.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]