From patchwork Thu Jun 25 21:47:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Manuel Torres Palma X-Patchwork-Id: 488563 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 167D014028F for ; Fri, 26 Jun 2015 07:48:08 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sourceware.org header.i=@sourceware.org header.b=leWwKcMd; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :content-type; q=dns; s=default; b=D/9Cy2Qo8WscbUxewVhs+YmZL9G+d UkkcvXW6pGJI9EcLB6pgqGlI2QEpL81p4ji9eZlHtVYVBkHSJn/kQ7tCPXMEB72+ YSm579rS5+0rtiqtXfiw4P1YdVPV0gz80nHHpSla6U+03IIyCr+xqJO7pf5KxjAW Uu8RclWPv73kvI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :content-type; s=default; bh=mOy8D+w9RGDTULIOd/f5DbgfiJA=; b=leW wKcMdzw8/HMGTOY5GlQVTjpJzcpFa0R7LB/XJLqckdNAjeyogJ8tkH+7y5lrkG29 daIOG4jbfwgLXTvkpylqr7rehIoTRdQa6+EykiAm1hDVVMQUVHLCXMkLboOdDZxn m/Y3+QpnF2DBZwG/5ytVQOmi77kbTGZD7rsagUuY= Received: (qmail 80348 invoked by alias); 25 Jun 2015 21:47:46 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 80290 invoked by uid 89); 25 Jun 2015 21:47:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-vn0-f47.google.com MIME-Version: 1.0 X-Received: by 10.52.6.226 with SMTP id e2mr2258916vda.29.1435268861156; Thu, 25 Jun 2015 14:47:41 -0700 (PDT) Date: Thu, 25 Jun 2015 23:47:40 +0200 Message-ID: Subject: [PATCH] Clean pthread functions namespace for C11 threads From: Juan Manuel Torres Palma To: libc-alpha This patch creates weak aliases for all conflicting functions with C11 threads.h functions, allowong user to redefine them. Some functions do not need aliases as they have already been defined as versioned symbols. Cheers. * nptl/pthreadP.h (__pthread_mutex_timedlock, __pthread_key_delete) (__pthread_detach, __pthread_join): Add functions prototypes. * nptl/pthread_detach.c (pthread_detach): Declare as weak alias. (__pthread_detach): Rename pthread_detach function. * nptl/pthread_equal.c (pthread_equal): Declare as weak alias. * nptl/pthread_exit.c (pthread_exit): Likewise. * nptl/pthread_getspecific.c (pthread_getspecific): Likewise. * nptl/pthread_join.c (pthread_join): Declare as weak alias. (__pthread_join): Rename pthread_join function. * nptl/pthread_key_create.c (pthread_key_create): Declare as weak alias. * nptl/pthread_key_delete.c (pthread_key_delete): Declare as weak alias. (__pthread_key_delete): Rename pthread_key_delete function. * nptl/pthread_mutex_destroy.c (pthread_mutex_destroy): Declare as weak alias. * nptl/pthread_mutex_init.c (pthread_mutex_init): Likewise. * nptl/pthread_mutex_lock.c (pthread_mutex_lock): Likewise. * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise. (__pthread_mutex_timedlock): Rename pthread_mutex_timedlock function. * nptl/pthread_mutex_trylock.c (pthread_mutex_trylock): Declare as weak alias. * nptl/pthread_mutex_unlock.c (pthread_mutex_unlock): Likewise. * nptl/pthread_self.c (pthread_self): Likewise. * nptl/pthread_setspecific.c (pthread_setspecific): Likewise. commit e843bb5428ac1cbd1fd2bb57292d0b7e696ddaea Author: Juan Manuel Torres Palma Date: Thu Jun 25 19:43:22 2015 +0200 Clean pthread functions namespaces for C11 threads This patch creates weak aliases for all conflicting functions with C11 threads.h functions, allowong user to redefine them. Some functions do not need aliases as they have already been defined as versioned symbols. diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index 84a7105..b997b22 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -414,6 +414,8 @@ extern int __pthread_mutex_init (pthread_mutex_t *__mutex, extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex); extern int __pthread_mutex_trylock (pthread_mutex_t *_mutex); extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); +extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex, + const struct timespec *__abstime); extern int __pthread_mutex_cond_lock (pthread_mutex_t *__mutex) attribute_hidden internal_function; extern void __pthread_mutex_cond_lock_adjust (pthread_mutex_t *__mutex) @@ -477,6 +479,7 @@ extern int __pthread_cond_timedwait (pthread_cond_t *cond, extern int __pthread_condattr_destroy (pthread_condattr_t *attr); extern int __pthread_condattr_init (pthread_condattr_t *attr); extern int __pthread_key_create (pthread_key_t *key, void (*destr) (void *)); +extern int __pthread_key_delete (pthread_key_t key); extern void *__pthread_getspecific (pthread_key_t key); extern int __pthread_setspecific (pthread_key_t key, const void *value); extern int __pthread_once (pthread_once_t *once_control, @@ -485,8 +488,10 @@ extern int __pthread_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void)); extern pthread_t __pthread_self (void); extern int __pthread_equal (pthread_t thread1, pthread_t thread2); +extern int __pthread_detach (pthread_t th); extern int __pthread_kill (pthread_t threadid, int signo); extern void __pthread_exit (void *value) __attribute__ ((__noreturn__)); +extern int __pthread_join (pthread_t threadid, void **thread_return); extern int __pthread_setcanceltype (int type, int *oldtype); extern int __pthread_enable_asynccancel (void) attribute_hidden; extern void __pthread_disable_asynccancel (int oldtype) diff --git a/nptl/pthread_detach.c b/nptl/pthread_detach.c index aa735f6..63e0635 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,4 @@ 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_getspecific.c b/nptl/pthread_getspecific.c index 0bee354..a5e5f45 100644 --- a/nptl/pthread_getspecific.c +++ b/nptl/pthread_getspecific.c @@ -64,5 +64,5 @@ __pthread_getspecific (key) return result; } -strong_alias (__pthread_getspecific, pthread_getspecific) +weak_alias (__pthread_getspecific, pthread_getspecific) hidden_def (__pthread_getspecific) diff --git a/nptl/pthread_join.c b/nptl/pthread_join.c index c841ff9..687d9bb 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,4 @@ pthread_join (pthread_t threadid, void **thread_return) return result; } +weak_alias(__pthread_join, pthread_join); diff --git a/nptl/pthread_key_create.c b/nptl/pthread_key_create.c index a642c69..9beec6b 100644 --- a/nptl/pthread_key_create.c +++ b/nptl/pthread_key_create.c @@ -49,5 +49,5 @@ __pthread_key_create (key, destr) return EAGAIN; } -strong_alias (__pthread_key_create, pthread_key_create) +weak_alias (__pthread_key_create, pthread_key_create) hidden_def (__pthread_key_create) diff --git a/nptl/pthread_key_delete.c b/nptl/pthread_key_delete.c index bd9b4a2..c6d4c06 100644 --- a/nptl/pthread_key_delete.c +++ b/nptl/pthread_key_delete.c @@ -22,7 +22,7 @@ int -pthread_key_delete (key) +__pthread_key_delete (key) pthread_key_t key; { int result = EINVAL; @@ -40,3 +40,4 @@ pthread_key_delete (key) return result; } +weak_alias(__pthread_key_delete, pthread_key_delete); diff --git a/nptl/pthread_mutex_destroy.c b/nptl/pthread_mutex_destroy.c index f6089df..3d40205 100644 --- a/nptl/pthread_mutex_destroy.c +++ b/nptl/pthread_mutex_destroy.c @@ -37,5 +37,5 @@ __pthread_mutex_destroy (mutex) return 0; } -strong_alias (__pthread_mutex_destroy, pthread_mutex_destroy) +weak_alias (__pthread_mutex_destroy, pthread_mutex_destroy) hidden_def (__pthread_mutex_destroy) diff --git a/nptl/pthread_mutex_init.c b/nptl/pthread_mutex_init.c index d71cfef..6b9ab16 100644 --- a/nptl/pthread_mutex_init.c +++ b/nptl/pthread_mutex_init.c @@ -148,5 +148,5 @@ __pthread_mutex_init (mutex, mutexattr) return 0; } -strong_alias (__pthread_mutex_init, pthread_mutex_init) +weak_alias (__pthread_mutex_init, pthread_mutex_init) hidden_def (__pthread_mutex_init) diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c index 9607512..4ee4280 100644 --- a/nptl/pthread_mutex_lock.c +++ b/nptl/pthread_mutex_lock.c @@ -516,7 +516,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex) return 0; } #ifndef __pthread_mutex_lock -strong_alias (__pthread_mutex_lock, pthread_mutex_lock) +weak_alias (__pthread_mutex_lock, pthread_mutex_lock) hidden_def (__pthread_mutex_lock) #endif diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c index 109a46a..cb91fde 100644 --- a/nptl/pthread_mutex_timedlock.c +++ b/nptl/pthread_mutex_timedlock.c @@ -40,7 +40,7 @@ #endif int -pthread_mutex_timedlock (mutex, abstime) +__pthread_mutex_timedlock (mutex, abstime) pthread_mutex_t *mutex; const struct timespec *abstime; { @@ -522,3 +522,4 @@ pthread_mutex_timedlock (mutex, abstime) out: return result; } +weak_alias(__pthread_mutex_timedlock, pthread_mutex_timedlock); diff --git a/nptl/pthread_mutex_trylock.c b/nptl/pthread_mutex_trylock.c index 33df384..229afdf 100644 --- a/nptl/pthread_mutex_trylock.c +++ b/nptl/pthread_mutex_trylock.c @@ -404,6 +404,6 @@ __pthread_mutex_trylock (mutex) #ifndef __pthread_mutex_trylock #ifndef pthread_mutex_trylock -strong_alias (__pthread_mutex_trylock, pthread_mutex_trylock) +weak_alias (__pthread_mutex_trylock, pthread_mutex_trylock) #endif #endif diff --git a/nptl/pthread_mutex_unlock.c b/nptl/pthread_mutex_unlock.c index 80939ba..d9ff351 100644 --- a/nptl/pthread_mutex_unlock.c +++ b/nptl/pthread_mutex_unlock.c @@ -314,5 +314,5 @@ __pthread_mutex_unlock (mutex) { return __pthread_mutex_unlock_usercnt (mutex, 1); } -strong_alias (__pthread_mutex_unlock, pthread_mutex_unlock) +weak_alias (__pthread_mutex_unlock, pthread_mutex_unlock) hidden_def (__pthread_mutex_unlock) 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) diff --git a/nptl/pthread_setspecific.c b/nptl/pthread_setspecific.c index a9cf26c..36b42f8 100644 --- a/nptl/pthread_setspecific.c +++ b/nptl/pthread_setspecific.c @@ -91,5 +91,5 @@ __pthread_setspecific (key, value) return 0; } -strong_alias (__pthread_setspecific, pthread_setspecific) +weak_alias (__pthread_setspecific, pthread_setspecific) hidden_def (__pthread_setspecific)