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]

[COMMITTED PATCH] NPTL: Remove gratuitous Linuxisms from gai_misc.h.


The use of INTERNAL_SYSCALL here was gratuitous Linuxism, presumably
motivated by gratuitous microoptimization.  In the context of making
multiple system calls and starting a thread, the function call overhead of
going through the normal API is negligible.  And checking for "impossible"
errors when not -DNDEBUG is just baseline sensible practice.

Tested x86_64-linux-gnu.


Thanks,
Roland


	* sysdeps/nptl/gai_misc.h (__gai_start_notify_thread):
	Use pthread_sigmask rather than INTERNAL_SYSCALL.
	Use assert_perror to check its return value.
	(__gai_create_helper_thread): Likewise.

--- a/sysdeps/nptl/gai_misc.h
+++ b/sysdeps/nptl/gai_misc.h
@@ -81,8 +81,8 @@ __gai_start_notify_thread (void)
 {
   sigset_t ss;
   sigemptyset (&ss);
-  INTERNAL_SYSCALL_DECL (err);
-  INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, NULL, _NSIG / 8);
+  int sigerr = pthread_sigmask (SIG_SETMASK, &ss, NULL);
+  assert_perror (sigerr);
 }
 
 extern inline int
@@ -105,14 +105,14 @@ __gai_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
   sigset_t ss;
   sigset_t oss;
   sigfillset (&ss);
-  INTERNAL_SYSCALL_DECL (err);
-  INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, &oss, _NSIG / 8);
+  int sigerr = pthread_sigmask (SIG_SETMASK, &ss, &oss);
+  assert_perror (sigerr);
 
   int ret = pthread_create (threadp, &attr, tf, arg);
 
   /* Restore the signal mask.  */
-  INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &oss, NULL,
-		    _NSIG / 8);
+  sigerr = pthread_sigmask (SIG_SETMASK, &oss, NULL);
+  assert_perror (sigerr);
 
   (void) pthread_attr_destroy (&attr);
   return ret;


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