From patchwork Wed Dec 17 22:10:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 422385 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 E1EC7140081 for ; Thu, 18 Dec 2014 09:10:48 +1100 (AEDT) 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:content-type :content-transfer-encoding:from:to:subject:message-id:date; q= dns; s=default; b=pUKFxA/2UTJV9gRuCB6+7VsNDHyI0XiV7DBF4QVsN8tZPE R4oHNqF2X+WD/qTdevfnh+KFnaZuTGV8cLzZbhKGsmxssqIsDi4g6R4s1orTUsdw j6cUwF7g/YgmAR18DHxQh/ri9jikjB+RbSc8ul5sYLNkj3wKN4fiYTMI2C+ZE= 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:content-type :content-transfer-encoding:from:to:subject:message-id:date; s= default; bh=R/wOYvfM4wr9Q7oaPNEn+oWeUzI=; b=Q1tXheNo0atHzzIXN3Ks Yl1eURlPySeRzz/ralcZ05FOVEmajDM3JcLxhlenSy0LnBbSsGePfHkFSvf8Fkcg LKu0a3OzHb8oX+8aTfCLaK7rF857NqzGWzit0jY118ptDXaZKf1wBrWwX96pguyn uxOtJJkVhDLS1KnVU1P1rC0= Received: (qmail 23674 invoked by alias); 17 Dec 2014 22:10:43 -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 23658 invoked by uid 89); 17 Dec 2014 22:10:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: topped-with-meat.com MIME-Version: 1.0 From: Roland McGrath To: "GNU C. Library" Subject: [COMMITTED PATCH] NPTL: Remove gratuitous Linuxisms from gai_misc.h. Message-Id: <20141217221037.E5A612C3ABF@topped-with-meat.com> Date: Wed, 17 Dec 2014 14:10:37 -0800 (PST) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=SvUDtp+0 c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=CqubfsGRV0Yu5qowX3kA:9 a=FGYmxdBoYovqBjir:21 a=4kTsswNkGyi9pMYG:21 a=CjuIK1q_8ugA:10 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;