]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Use __pthread_setcancelstate in libc.a
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 17 Sep 2015 23:38:54 +0000 (16:38 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 17 Sep 2015 23:38:54 +0000 (16:38 -0700)
This patch references __pthread_setcancelstate instead of
pthread_setcancelstate in libc.a.

[BZ #18970]
* misc/error.c (error): Replace pthread_setcancelstate with
__pthread_setcancelstate.
(error_at_line): Likewise.
* posix/wordexp.c (parse_comm): Likewise.
* stdlib/fmtmsg.c (fmtmsg): Likewise.
* nptl/forward.c (pthread_setcancelstate): Renamed to ...
(__pthread_setcancelstate): This.
(pthread_setcancelstate): Add an alias.
* nptl/nptl-init.c (pthread_functions): Replace
ptr_pthread_setcancelstate with ptr___pthread_setcancelstate.
* sysdeps/nptl/pthread-functions.h (pthread_functions): Likewise.
* nptl/pthreadP.h (__pthread_setcancelstate): Mark it with
hidden_proto.
* nptl/pthread_setcancelstate.c (__pthread_setcancelstate): Mark
it with hidden_def.
* sysdeps/nptl/libc-lockP.h (__pthread_setcancelstate): New.
(pthread_setcancelstate): Renamed to ...
(__pthread_setcancelstate): This.
* sysdeps/unix/sysv/linux/fatal-prepare.h (FATAL_PREPARE): Use
__libc_ptf_call with __pthread_setcancelstate.

12 files changed:
ChangeLog
NEWS
misc/error.c
nptl/forward.c
nptl/nptl-init.c
nptl/pthreadP.h
nptl/pthread_setcancelstate.c
posix/wordexp.c
stdlib/fmtmsg.c
sysdeps/nptl/libc-lockP.h
sysdeps/nptl/pthread-functions.h
sysdeps/unix/sysv/linux/fatal-prepare.h

index 4de1a56fd445526ff998ad2648e62bbc5457af03..dd01ca1efbcb4047b26be54b2c99925557a8de05 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2015-09-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+       [BZ #18970]
+       * misc/error.c (error): Replace pthread_setcancelstate with
+       __pthread_setcancelstate.
+       (error_at_line): Likewise.
+       * posix/wordexp.c (parse_comm): Likewise.
+       * stdlib/fmtmsg.c (fmtmsg): Likewise.
+       * nptl/forward.c (pthread_setcancelstate): Renamed to ...
+       (__pthread_setcancelstate): This.
+       (pthread_setcancelstate): Add an alias.
+       * nptl/nptl-init.c (pthread_functions): Replace
+       ptr_pthread_setcancelstate with ptr___pthread_setcancelstate.
+       * sysdeps/nptl/pthread-functions.h (pthread_functions): Likewise.
+       * nptl/pthreadP.h (__pthread_setcancelstate): Mark it with
+       hidden_proto.
+       * nptl/pthread_setcancelstate.c (__pthread_setcancelstate): Mark
+       it with hidden_def.
+       * sysdeps/nptl/libc-lockP.h (__pthread_setcancelstate): New.
+       (pthread_setcancelstate): Renamed to ...
+       (__pthread_setcancelstate): This.
+       * sysdeps/unix/sysv/linux/fatal-prepare.h (FATAL_PREPARE): Use
+       __libc_ptf_call with __pthread_setcancelstate.
+
 2015-09-17  Joseph Myers  <joseph@codesourcery.com>
            Andreas Schwab  <schwab@suse.de>
 
diff --git a/NEWS b/NEWS
index d9787014c479b98a6b0fadfce9cc3a194348df5c..e5a4629858491591cd5dba84303cca604df76dc5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,7 +15,7 @@ Version 2.23
   18421, 18480, 18525, 18595, 18610, 18618, 18647, 18661, 18674, 18675,
   18681, 18757, 18778, 18781, 18787, 18789, 18790, 18795, 18796, 18820,
   18823, 18824, 18857, 18863, 18870, 18872, 18873, 18875, 18887, 18921,
-  18951, 18952, 18961, 18966, 18967, 18977.
+  18951, 18952, 18961, 18966, 18967, 18970, 18977
 
 * The obsolete header <regexp.h> has been removed.  Programs that require
   this header must be updated to use <regex.h> instead.
index aa3054d9ee5fb066df41b539d4653151bf95f764..023e391f4dbc2738d0dbc1f369f4a17d9fb43e1b 100644 (file)
@@ -298,8 +298,8 @@ error (int status, int errnum, const char *message, ...)
   /* We do not want this call to be cut short by a thread
      cancellation.  Therefore disable cancellation for now.  */
   int state = PTHREAD_CANCEL_ENABLE;
-  __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
-                  0);
+  __libc_ptf_call (__pthread_setcancelstate,
+                  (PTHREAD_CANCEL_DISABLE, &state), 0);
 #endif
 
   flush_stdout ();
@@ -323,7 +323,7 @@ error (int status, int errnum, const char *message, ...)
 #ifdef _LIBC
   _IO_funlockfile (stderr);
 # ifdef __libc_ptf_call
-  __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
+  __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
 # endif
 #endif
 }
@@ -360,7 +360,8 @@ error_at_line (int status, int errnum, const char *file_name,
   /* We do not want this call to be cut short by a thread
      cancellation.  Therefore disable cancellation for now.  */
   int state = PTHREAD_CANCEL_ENABLE;
-  __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
+  __libc_ptf_call (__pthread_setcancelstate,
+                  (PTHREAD_CANCEL_DISABLE, &state),
                   0);
 #endif
 
@@ -393,7 +394,7 @@ error_at_line (int status, int errnum, const char *file_name,
 #ifdef _LIBC
   _IO_funlockfile (stderr);
 # ifdef __libc_ptf_call
-  __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
+  __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
 # endif
 #endif
 }
index db74f8df9209e5b6a6c84c503f7a89bfc1393e67..57a12a427bbf2d59dcc28c453531ac5b4c188aa1 100644 (file)
@@ -197,8 +197,9 @@ FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0)
 FORWARD2 (pthread_self, pthread_t, (void), (), return 0)
 
 
-FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate),
-        0)
+FORWARD (__pthread_setcancelstate, (int state, int *oldstate),
+        (state, oldstate), 0)
+strong_alias (__pthread_setcancelstate, pthread_setcancelstate)
 
 FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
 
index c043fb50ab98b534e3cecb6c016fa6ab920c5c9b..79bcaab19decabd110cb16e1885cbc0eaa5e11f2 100644 (file)
@@ -127,7 +127,7 @@ static const struct pthread_functions pthread_functions =
     .ptr_pthread_mutex_lock = __pthread_mutex_lock,
     .ptr_pthread_mutex_unlock = __pthread_mutex_unlock,
     .ptr_pthread_self = __pthread_self,
-    .ptr_pthread_setcancelstate = __pthread_setcancelstate,
+    .ptr___pthread_setcancelstate = __pthread_setcancelstate,
     .ptr_pthread_setcanceltype = __pthread_setcanceltype,
     .ptr___pthread_cleanup_upto = __pthread_cleanup_upto,
     .ptr___pthread_once = __pthread_once,
index 8cd51c65ad01136041f3fbd7c3c2473ab1311885..b96be564937c37d88c506922f07fb24ed929b27d 100644 (file)
@@ -504,6 +504,7 @@ hidden_proto (__pthread_key_create)
 hidden_proto (__pthread_getspecific)
 hidden_proto (__pthread_setspecific)
 hidden_proto (__pthread_once)
+hidden_proto (__pthread_setcancelstate)
 #endif
 
 extern int __pthread_cond_broadcast_2_0 (pthread_cond_2_0_t *cond);
index 1807789caa9cc992947e51ebd123c3f0b0e9c02e..c8bc8b883cc6830c980136c71ef26c7f3039500f 100644 (file)
@@ -70,3 +70,4 @@ __pthread_setcancelstate (state, oldstate)
   return 0;
 }
 strong_alias (__pthread_setcancelstate, pthread_setcancelstate)
+hidden_def (__pthread_setcancelstate)
index 49ab71d6c28b9ef8e7c27fbad722e515d43c8f04..a36d2f9651526d3393b3e24ab1679cccde9779e8 100644 (file)
@@ -1186,7 +1186,7 @@ parse_comm (char **word, size_t *word_length, size_t *max_length,
                  // XXX Ideally we do want the thread being cancelable.
                  // XXX If demand is there we'll change it.
                  int state = PTHREAD_CANCEL_ENABLE;
-                 __libc_ptf_call (pthread_setcancelstate,
+                 __libc_ptf_call (__pthread_setcancelstate,
                                   (PTHREAD_CANCEL_DISABLE, &state), 0);
 #endif
 
@@ -1194,7 +1194,8 @@ parse_comm (char **word, size_t *word_length, size_t *max_length,
                                     flags, pwordexp, ifs, ifs_white);
 
 #ifdef __libc_ptf_call
-                 __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
+                 __libc_ptf_call (__pthread_setcancelstate,
+                                  (state, NULL), 0);
 #endif
 
                  free (comm);
index a7abcbba8c2505ed59600393d40997ce32439aa7..7b62c4efa11ef7d23ccd1dc63d07582f21f5cde9 100644 (file)
@@ -127,8 +127,8 @@ fmtmsg (long int classification, const char *label, int severity,
   /* We do not want this call to be cut short by a thread
      cancellation.  Therefore disable cancellation for now.  */
   int state = PTHREAD_CANCEL_ENABLE;
-  __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
-                  0);
+  __libc_ptf_call (__pthread_setcancelstate,
+                  (PTHREAD_CANCEL_DISABLE, &state), 0);
 #endif
 
   __libc_lock_lock (lock);
@@ -199,7 +199,7 @@ fmtmsg (long int classification, const char *label, int severity,
   __libc_lock_unlock (lock);
 
 #ifdef __libc_ptf_call
-  __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
+  __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
 #endif
 
   return result;
index a64daca008596ef95385877a8e0cfab65ee13748..29494fd67bcf1393a95a643e370cb61778662aeb 100644 (file)
@@ -376,6 +376,7 @@ extern int __pthread_atfork (void (*__prepare) (void),
                             void (*__parent) (void),
                             void (*__child) (void));
 
+extern int __pthread_setcancelstate (int state, int *oldstate);
 
 
 /* Make the pthread functions weak so that we can elide them from
@@ -403,9 +404,9 @@ weak_extern (__pthread_getspecific)
 weak_extern (__pthread_once)
 weak_extern (__pthread_initialize)
 weak_extern (__pthread_atfork)
+weak_extern (__pthread_setcancelstate)
 weak_extern (_pthread_cleanup_push_defer)
 weak_extern (_pthread_cleanup_pop_restore)
-weak_extern (pthread_setcancelstate)
 # else
 #  pragma weak __pthread_mutex_init
 #  pragma weak __pthread_mutex_destroy
@@ -427,9 +428,9 @@ weak_extern (pthread_setcancelstate)
 #  pragma weak __pthread_once
 #  pragma weak __pthread_initialize
 #  pragma weak __pthread_atfork
+#  pragma weak __pthread_setcancelstate
 #  pragma weak _pthread_cleanup_push_defer
 #  pragma weak _pthread_cleanup_pop_restore
-#  pragma weak pthread_setcancelstate
 # endif
 #endif
 
index 0784c59cab43d0a560a66c4317050e2bbbd0f0c4..f37e9fd4b8a9cd0c8634727c0d8b8a66dc762f92 100644 (file)
@@ -75,7 +75,7 @@ struct pthread_functions
   int (*ptr_pthread_mutex_lock) (pthread_mutex_t *);
   int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *);
   pthread_t (*ptr_pthread_self) (void);
-  int (*ptr_pthread_setcancelstate) (int, int *);
+  int (*ptr___pthread_setcancelstate) (int, int *);
   int (*ptr_pthread_setcanceltype) (int, int *);
   void (*ptr___pthread_cleanup_upto) (__jmp_buf, char *);
   int (*ptr___pthread_once) (pthread_once_t *, void (*) (void));
index 45d88ce91172b93e451ad598dd30000c10df6ba7..2a895672994c18f0afa08da8ea58a05286b20815 100644 (file)
 
 /* We have to completely disable cancellation.  assert() must not be a
    cancellation point but the implementation uses write() etc.  */
-#ifdef SHARED
-# include <pthread-functions.h>
-# define FATAL_PREPARE \
-  {                                                                          \
-    if (__libc_pthread_functions_init)                                       \
-      PTHFCT_CALL (ptr_pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE,              \
-                                               NULL));                       \
-  }
-#else
-# pragma weak pthread_setcancelstate
-# define FATAL_PREPARE \
-  {                                                                          \
-    if (pthread_setcancelstate != NULL)                                              \
-      pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL);                 \
-  }
-#endif
+#define FATAL_PREPARE \
+  __libc_ptf_call (__pthread_setcancelstate, \
+                  (PTHREAD_CANCEL_DISABLE, NULL), 0)