From patchwork Thu Aug 3 13:11:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 109331 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp763584qge; Thu, 3 Aug 2017 06:13:02 -0700 (PDT) X-Received: by 10.99.120.193 with SMTP id t184mr1537929pgc.35.1501765982239; Thu, 03 Aug 2017 06:13:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501765982; cv=none; d=google.com; s=arc-20160816; b=KYCZB7/4S+mOhyx3zB2TlD1YCulTK3OL+TeYa0apH1SesN8Rsa0YLEU0SzW7NLuDWE UbVb+/OHco6m6yXWA6JVYH3HD43MtI9gBs+bVpZivk5FwymxQaERYeG3xFtSH2DfBEqP 5oeTyY0pXY4Kx0WKNtQnTAaH+7eN0zh5rkLzz7EhPFnf0Em6/8ebBMniFVttFZpYjuym U92rfoX0RePUHZ+LXBf0V9FSnYoTIJw8EHteH6lidXEGwQiZuI4KxCN98J4rr0Wuz97t uJizx6It2Iys6LouujJZjYRDfNiHfF4/yFnikNvHC5vFdL2QSrcclmdLWArvhAROPE3e xY0w== 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=XmzEcon+vKIsFQ7y10MNGj6JK6jkt+vVOcMUTkHfolg=; b=rpW2HlwiFBxuuxgfB74LhxDuXfZ/atHxexbGHmIF20U7nXxggKqOLgmqVG6STWa+Mr osJmDTPqq/EM8SY5m3FnuSQ8kxsEY/Bh+xkOjpidMq1Ja1UN/2GgC3fsUnUdPgohKiX1 a+LL8+aP/dTZi1RYxqgw+N4i1w9mdW5uBz1ssleQlBqZfzHXqR5K4fO3K5YyX57mFYSG lAfmRm4vrRzGRmoClzPNMRh8LAs4MiVrO3HEcKvBpNmctIG0T/eMcBrcb2YAaX9S25Qq L3DF9MD7xImaXGMDbpgUxv+neI0CsQkHrP5T04lJRS/7kHLdP/f4/4XBZmwJp+WQpzwT 45Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.b=sky2c1ZQ; spf=pass (google.com: domain of libc-alpha-return-82685-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-82685-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 13si794408plb.565.2017.08.03.06.13.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Aug 2017 06:13:02 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-82685-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=sky2c1ZQ; spf=pass (google.com: domain of libc-alpha-return-82685-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-82685-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=u8yW6YkS+N+3SdToJcVDbgoOIzQgQXH M9BUjUjVbQ1xSEbZAPo0/MfIRfKe0EuVWR20DlpmHMz/8YI5ZNEC9MEDaaNlp8sg A8qZFzvrkCXYPqg0IsSKfboF9y27yHKCoaFVqLrM92aqGQqaHpyZEH5Efqk145A/ JEVf/0DEz1Yw= 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=mALQoyPTKU6C2ROsrVNe9VcZmP8=; b=sky2c 1ZQhU22AmEzbrIs+7Rk6XN8yLyBzgonDTlmHS/1ZpiTIdMyDP3zIc23uhVTz3CSk Du8pNlu9GnPgwi1DqytKizhkYdt7UBKW3tbdrAFt4f7tFWC0oCYjxT7UCpjOZaJD xYOmO8DKezmdAkW7g1Sdo0qRy+1XsfNIO/YMok= Received: (qmail 61650 invoked by alias); 3 Aug 2017 13:11:53 -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 61578 invoked by uid 89); 3 Aug 2017 13:11:52 -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-qt0-f172.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=XmzEcon+vKIsFQ7y10MNGj6JK6jkt+vVOcMUTkHfolg=; b=k0kIrX7DhDJ4MIEEV1MeZjhKKfv/c1zpe/QQPNRCQXwLGWhlJgpsPxqZq1NgYXlu+I bC4dKYWqx3jAzh7sZJpmXXThQd7/fIdygpujaFvvg6TEigbNUMPKiNVzRUT5ni9Kq2tX KKEBhLeYK9RaHBh97nP0tZyV5LQf7+xgAQYXXt8m5CjnlMxA/5zshKw5uZoWsM9FvhK0 /mva5O4IueDgNufn8of85893pCrx9x0Z/rDrJFEMWTcb6kxmKrZfj8cOkZ+y9NzrqESN 0Iy0UJQjnjquLR/DjA620IaF1qLzVoE8/my5ljM0K11ysVjRXRKMqTTjIm5XyH93VJ7r U87Q== X-Gm-Message-State: AHYfb5h4p0WSIP6hchAmAcwsIZwhrMQrkhIUWsEUcnhdQ7hZn37QVGLV R5wLQ0XE3oDCcEvYAuRzSg== X-Received: by 10.200.51.129 with SMTP id c1mr2131864qtb.71.1501765908195; Thu, 03 Aug 2017 06:11:48 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 08/14] Consolidate non cancellable waitpid call Date: Thu, 3 Aug 2017 10:11:08 -0300 Message-Id: <1501765874-6201-9-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1501765874-6201-1-git-send-email-adhemerval.zanella@linaro.org> References: <1501765874-6201-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. * sysdeps/unix/sysv/linux/waitpid.c (__waitpid_nocancel): New symbol. --- 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 cf84550..3f924c8 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 8f567d3..ad46d62 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)