From patchwork Tue Jul 4 19:53:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 107017 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1361471qge; Tue, 4 Jul 2017 12:55:16 -0700 (PDT) X-Received: by 10.84.231.199 with SMTP id g7mr18087843pln.258.1499198115934; Tue, 04 Jul 2017 12:55:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499198115; cv=none; d=google.com; s=arc-20160816; b=NHP3+jg87EnCa0yRTU7NXOiqDIs8BKc+Cc+YhJi9nuCdeTsNytnJsr7CWHWVM8BA9B hQCtHxoox4XYd8RFsaZXvlBO0QkqejUcnVWnvKBKbk/YaDR0FxWiB+G9UmRhFrtIExyj R8FYXRkTPjwMZwMVYb7J+8V7qxNHdG/YSarlC8AdjnSBWFmTY3mjWgCUlt0F1v/q20iz PhVMwelpfZXn4lVgJlsDcAVqAq9uvgO7z80L3nelLhAsu02ujrusm6vOH44Ur2/Ce60c L9vjsfbh0sYHLzpQDzKZxaD+UrCsH+M7ezRGkwm/1zEYx3pNRuY6VkcSe8T1j8uq1DKK mihQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from:delivered-to :sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=8sCDcwyNuEjO1BshqJo9954riFTBac5yeyrEGzulo2I=; b=hC38Cds1CA0XGgbKSu2+KiQ5N3xQGYFR7lVIA/sDdev/34CG1Ts5DxXySdYBtt+ahV e7SYWtbM1qF2PdRXPlsVDEPnfresa6nFtprAx27Zqb+dlbRKXNQ0uGV/uKwz+yNEoZ+n 3oE0aBOhR2vludQ4I44NZpynGBn6zMii3gi0vogqzLzG2DBA/UzAstlL49tTHnzdE31k er2kz+214Mj1CAm+tPfqxJl8V6tDINXfYr8nxvWjxhCygItrb/cboLZIMxWZ0JXpRQss +BTrhJRykfcjPAPPjsweLhHK/1KHSURNjQ9wjMvO4vHn+sORxy1fBCmXjsh82gJucAXa d83Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.b=PNrTqPLD; spf=pass (google.com: domain of libc-alpha-return-81667-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-81667-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id r63si16339047plb.589.2017.07.04.12.55.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2017 12:55:15 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-81667-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.b=PNrTqPLD; spf=pass (google.com: domain of libc-alpha-return-81667-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-81667-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=P2eEr/NPBPmURJ7btPTsQH+kxTrqaA5 2ZdmTVnf6u6nGG6LmtxDMnLzeCC7m67IsVfFGw6/nmmbtAIrPC4T9yxTyA/IPGE4 mZOSCkTQRlNzT99GMFNy3OPczsWtJf2pHF/kShUooQzKeN9Mw01WIJ0iRNFzN/Vg Ja4VZE/xz3ac= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=kOHkeiq7Boa1VHcI7ZOscuthOxU=; b=PNrTq PLDHUmQBI0zH8dz7YEhplCeaeD1Aee2UPg0UohOlgrBokL0XCist77skSQn3x+ph sTu9ojeXti06vBsBmNPRJxgtfHkZSU9QSBl/aXpCdx+OCHrjWqktKfGFtnqJEgXA ri5eW69guXOkGlRG7onQA5n5AKSyaGhiJJAcS4= Received: (qmail 74589 invoked by alias); 4 Jul 2017 19:54:23 -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 74022 invoked by uid 89); 4 Jul 2017 19:54:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=3314 X-HELO: mail-qk0-f173.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=8sCDcwyNuEjO1BshqJo9954riFTBac5yeyrEGzulo2I=; b=nx7l4PDFyTsYiJQtVrOaK71Vtn66I8GLPesotv+rDGv+kYbgTQwa7yZYaZbA4s5CZ+ Ulcjc+1GI7pp528RWtr/xg7Z856N4O+m1MOjXVwseGvKW4j3nW65cp5mQhw6/KYiOskR 6y38utsj8QzyhSCseMHO/nyg7IdNWXk0VfyKiIqnzYxaoJteYD5O8WQwgfR687Zezl7g 4mkCmuXd8x0BFpu6FfdwGH4JIsfvmCNyTpnJlLllLiomKny6yP2gOWPU/zxD0X2VHFcb V2jlhdzpw+BZQ4Xf+qEcL1KRS6vrp3y92EPJHj4RrpeU0IKjxfdoZj0L6/pGQEmM+7XU TJBA== X-Gm-Message-State: AKS2vOwLlqZNc0tASt0JxfK8hm8KvQ9IA2B9lM4LNMAzm61BSn/NwBci sbbP5xQJZfS+km/kXOMILA== X-Received: by 10.55.204.133 with SMTP id n5mr50951946qkl.135.1499198053424; Tue, 04 Jul 2017 12:54:13 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 08/14] Consolidate non cancellable waitpid call Date: Tue, 4 Jul 2017 16:53:48 -0300 Message-Id: <1499198034-5837-9-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1499198034-5837-1-git-send-email-adhemerval.zanella@linaro.org> References: <1499198034-5837-1-git-send-email-adhemerval.zanella@linaro.org> This patch consolidates all the non cancellable waitpid calls to use the __waitpid_nocancel identifier. For non cancellable targets it will be just a macro to call the default respective symbol while on Linux will be a internal one. Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu. * login/utmp_file.c (timeout_handler): Replace fcntl_not_cancel with __fcntl_nocancel. * sysdeps/generic/not-cancel.h (fcntl_not_cancel): Remove macro. * sysdeps/unix/sysv/linux/not-cancel.h (fcntl_not_cancel): Likewise. --- libio/iopopen.c | 2 +- sysdeps/generic/not-cancel.h | 2 +- sysdeps/unix/sysv/linux/not-cancel.h | 7 +++---- sysdeps/unix/sysv/linux/waitpid.c | 15 ++++++++++++++- 4 files changed, 19 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/libio/iopopen.c b/libio/iopopen.c index 0c20cbb..a2ddebb 100644 --- a/libio/iopopen.c +++ b/libio/iopopen.c @@ -61,7 +61,7 @@ extern int _IO_dup2 (int fd, int fd2) __THROW; #ifndef _IO_waitpid #ifdef _LIBC -#define _IO_waitpid waitpid_not_cancel +#define _IO_waitpid __waitpid_nocancel #else #define _IO_waitpid waitpid #endif diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h index fa7b4d3..6c3afc2 100644 --- a/sysdeps/generic/not-cancel.h +++ b/sysdeps/generic/not-cancel.h @@ -36,7 +36,7 @@ __write (fd, buf, n) #define __writev_nocancel_nostatus(fd, iov, n) \ (void) __writev (fd, iov, n) -# define waitpid_not_cancel(pid, stat_loc, options) \ +# define __waitpid_nocancel(pid, stat_loc, options) \ __waitpid (pid, stat_loc, options) #define pause_not_cancel() \ __pause () diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h index 625bbaa..3047848 100644 --- a/sysdeps/unix/sysv/linux/not-cancel.h +++ b/sysdeps/unix/sysv/linux/not-cancel.h @@ -25,6 +25,7 @@ #include #include #include +#include /* Non cancellable open syscall. */ __typeof (open) __open_nocancel; @@ -73,10 +74,8 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt) } /* Uncancelable waitpid. */ -#define __waitpid_nocancel(pid, stat_loc, options) \ - INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL) -#define waitpid_not_cancel(pid, stat_loc, options) \ - __waitpid_nocancel(pid, stat_loc, options) +__typeof (waitpid) __waitpid_nocancel; +libc_hidden_proto (__waitpid_nocancel) /* Uncancelable pause. */ #define pause_not_cancel() \ diff --git a/sysdeps/unix/sysv/linux/waitpid.c b/sysdeps/unix/sysv/linux/waitpid.c index 2fed421..052462d 100644 --- a/sysdeps/unix/sysv/linux/waitpid.c +++ b/sysdeps/unix/sysv/linux/waitpid.c @@ -16,10 +16,12 @@ . */ #include -#include #include #include +#include +#include + __pid_t __waitpid (__pid_t pid, int *stat_loc, int options) { @@ -31,3 +33,14 @@ __waitpid (__pid_t pid, int *stat_loc, int options) } libc_hidden_def (__waitpid) weak_alias (__waitpid, waitpid) + +__pid_t +__waitpid_nocancel (__pid_t pid, int *stat_loc, int options) +{ +#ifdef __NR_waitpid + return INLINE_SYSCALL_CALL (waitpid, pid, stat_loc, options); +#else + return INLINE_SYSCALL_CALL (wait4, pid, stat_loc, options, NULL); +#endif +} +libc_hidden_def (__waitpid_nocancel)