From patchwork Tue Jul 4 19:53:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 107019 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1361685qge; Tue, 4 Jul 2017 12:55:37 -0700 (PDT) X-Received: by 10.99.67.68 with SMTP id q65mr17200065pga.260.1499198137651; Tue, 04 Jul 2017 12:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499198137; cv=none; d=google.com; s=arc-20160816; b=PJgD/e/sVeL7KSFo2EqeE1eWkpY3GabFVul7EfQfAZ0ohams3DlnDnqKzrFLCbwKhj hkrkwRec8Mb3932zCsMh3NoqkOlyZzR6y7PWqAnP1+2uDT9RjH64md/oplD3Raaa37jV AX40FKEW4JPWtcWWKmY3ppXHzZSVTE3Iz8Hz9pI8Lmn+hWTkUHBb4+5JVefM2NAiFSa2 AjYiPGldaoi/DdHxhXun1Af+Qg8rEfJHy2RqxzVfROzGUdHyZxJ+vLTJ1A3kxiNOGqYp dGo2Y0l9uXKXQyGuQ1gLuAo9zAeJM5/aHgIYdeVWTfbbsQ4Gtky5zYmHB7SE0ZEuu9A1 mfHw== 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=XEecaJqrXxRlEdFexnOLR+Qjquz1J5T1sih4gaDSfGA=; b=DoEUwdDK1vZLvpU1pctGUWVMfGKRhyKEvxPGmF6zaYEb5YkfmumeAoFieXboPlzLZB M9qt+kyyTGaf7QKPzidIIeJToH2CsEE8hniJGOGMHrEuhoZS5wzKwuqIaS7ODYavGunv ZYZ+AvDfzRkU535Xm2z/D7Sczq/Rh3C43htAamhYM6Vy3eOzf01/+8emQjHxD4g6B+Rl EwWEizP/xFd8pecLOVdfzCvTSNd8JyFEvUwm4MwCIFJd9fYAfW5I+kqVA0W7iNuSiMiH YY7Ax31qbBfVxquIGNoonicU1ewOoxDm2zIIsZd88kOBRyCTcgX3U5B5kJVyutQrADMu TSXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.b=ui7yCTDQ; spf=pass (google.com: domain of libc-alpha-return-81668-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-81668-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 191si11678269pfu.378.2017.07.04.12.55.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2017 12:55:37 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-81668-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=ui7yCTDQ; spf=pass (google.com: domain of libc-alpha-return-81668-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-81668-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=kWJSnGGDui3BGxfAr8hOlOSLD+NPMoy WW7tuaxXb9cjycTgnMLHN31VuZVsOG/QLgwU+I3BXLOZm55UgXvWN5lQsGaEHIhU R/i19g1IITI7Vmpa3t7T0s3QLs8AsQl/n0E6kwERE197M/BqJwr74lDhna/SA747 EbYKT0s3W/Mo= 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=Qh1I7Cer1hn8j1wPTjhoZSkw1vQ=; b=ui7yC TDQWkCc6r2keH9HjiE7/dA64WlyH09oCxq+KmEkKkAk/RJPg0d/Gc8yCqZxEdzMF GKBraW2ojqgEZ0saqsnwqgk5V0Ek6BEzhHlgeCKAB9qeduVxQdv56PWvazNnHZ1Y yOwcfEk60jTmiZ4ot1EbegxnPlu27z3gyIUS4c= Received: (qmail 74718 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 73808 invoked by uid 89); 4 Jul 2017 19:54:16 -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= 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=XEecaJqrXxRlEdFexnOLR+Qjquz1J5T1sih4gaDSfGA=; b=FYZzLqqjNSIP1nMle8IzdkxpTAy6uqRyYLtJofL/08mooWfTO406K+YFFbATcmCypK nA5gsCCT7PbRk9+H0ojwvJu92VhZZdeCYH4b2ldHFEXVC+AYasx1w257XOnr3NyL+Qdo RShBFD5GkdFdvo/Sxo/QRkVRb3X6YaGO+d25QASmQJI51w1Uskzdg5FoQgeQFHrN9wSa klkdYloZB6Lb9DLA6EFxDnvI65WDKvG+KbubtblSVIjn3Khbthq1XnhlX66tjIV69v5l RRu6bHt5/8ofB5B+FZ2BeeLX1w5X+l8Oac1XOutb32/NPKXgvsB7Ozdj458n1zhmtkb5 Tyeg== X-Gm-Message-State: AKS2vOxQP7AlsGwOrB4/+XhIWfAn9e1+1D0jUKK2vAV8+9Qx9VKafoaO z7aIsMyCuiWG9dUMzb5tDQ== X-Received: by 10.55.112.66 with SMTP id l63mr50557580qkc.56.1499198050671; Tue, 04 Jul 2017 12:54:10 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 06/14] Consolidate non cancellable writev call Date: Tue, 4 Jul 2017 16:53:46 -0300 Message-Id: <1499198034-5837-7-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 writev calls to use the __writev_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. * gmon/gmon.c (write_hist): Replace writev_not_cancel_no_status with __writev_nocancel_nostatus. (write_call_graph): Likewise. (write_bb_counts): Likewise. * resolv/herror.c (herror): Likewise. * sysdeps/generic/not-cancel.h (writev_not_cancel_no_status): Remove macro. (__writev_nocancel_nostatus): New macro. * sysdeps/unix/sysv/linux/not-cancel.h (writev_not_cancel_no_status): Remove macro. (__writev_nocancel_nostatus): New function. --- ChangeLog | 12 ++++++++++++ gmon/gmon.c | 12 ++++++------ resolv/herror.c | 2 +- sysdeps/generic/not-cancel.h | 2 +- sysdeps/unix/sysv/linux/not-cancel.h | 12 ++++++++---- 5 files changed, 28 insertions(+), 12 deletions(-) -- 2.7.4 diff --git a/gmon/gmon.c b/gmon/gmon.c index b26c27a..8408e53 100644 --- a/gmon/gmon.c +++ b/gmon/gmon.c @@ -216,7 +216,7 @@ write_hist (int fd) strncpy (thdr.dimen, "seconds", sizeof (thdr.dimen)); thdr.dimen_abbrev = 's'; - writev_not_cancel_no_status (fd, iov, 3); + __writev_nocancel_nostatus (fd, iov, 3); } } @@ -273,13 +273,13 @@ write_call_graph (int fd) if (++nfilled == NARCS_PER_WRITEV) { - writev_not_cancel_no_status (fd, iov, 2 * nfilled); + __writev_nocancel_nostatus (fd, iov, 2 * nfilled); nfilled = 0; } } } if (nfilled > 0) - writev_not_cancel_no_status (fd, iov, 2 * nfilled); + __writev_nocancel_nostatus (fd, iov, 2 * nfilled); } @@ -312,12 +312,12 @@ write_bb_counts (int fd) for (grp = __bb_head; grp; grp = grp->next) { ncounts = grp->ncounts; - writev_not_cancel_no_status (fd, bbhead, 2); + __writev_nocancel_nostatus (fd, bbhead, 2); for (nfilled = i = 0; i < ncounts; ++i) { if (nfilled > (sizeof (bbbody) / sizeof (bbbody[0])) - 2) { - writev_not_cancel_no_status (fd, bbbody, nfilled); + __writev_nocancel_nostatus (fd, bbbody, nfilled); nfilled = 0; } @@ -325,7 +325,7 @@ write_bb_counts (int fd) bbbody[nfilled++].iov_base = &grp->counts[i]; } if (nfilled > 0) - writev_not_cancel_no_status (fd, bbbody, nfilled); + __writev_nocancel_nostatus (fd, bbbody, nfilled); } } diff --git a/resolv/herror.c b/resolv/herror.c index b3df236..45c0a5d 100644 --- a/resolv/herror.c +++ b/resolv/herror.c @@ -89,7 +89,7 @@ herror(const char *s) { v++; v->iov_base = (char *) "\n"; v->iov_len = 1; - writev_not_cancel_no_status(STDERR_FILENO, iov, (v - iov) + 1); + __writev_nocancel_nostatus(STDERR_FILENO, iov, (v - iov) + 1); } /* diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h index 53214cd..9959c87 100644 --- a/sysdeps/generic/not-cancel.h +++ b/sysdeps/generic/not-cancel.h @@ -34,7 +34,7 @@ __read (fd, buf, n) #define __write_nocancel(fd, buf, n) \ __write (fd, buf, n) -#define writev_not_cancel_no_status(fd, iov, n) \ +#define __writev_nocancel_nostatus(fd, iov, n) \ (void) __writev (fd, iov, n) #define fcntl_not_cancel(fd, cmd, val) \ __fcntl (fd, cmd, val) diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h index c620c8a..7fd42c2 100644 --- a/sysdeps/unix/sysv/linux/not-cancel.h +++ b/sysdeps/unix/sysv/linux/not-cancel.h @@ -63,10 +63,14 @@ __close_nocancel_no_status (int fd) return INTERNAL_SYSCALL (close, err, 1, (fd)); } -/* Uncancelable writev. */ -#define writev_not_cancel_no_status(fd, iov, n) \ - (void) ({ INTERNAL_SYSCALL_DECL (err); \ - INTERNAL_SYSCALL (writev, err, 3, (fd), (iov), (n)); }) +/* Non cancellable writev syscall that does not also set errno in case of + failure. */ +static inline int +__writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt) +{ + INTERNAL_SYSCALL_DECL (err); + return INTERNAL_SYSCALL_CALL (writev, err, fd, iov, iovcnt); +} /* Uncancelable fcntl. */ #define fcntl_not_cancel(fd, cmd, val) \