From patchwork Mon May 8 15:26:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 98826 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1382834qge; Mon, 8 May 2017 08:27:15 -0700 (PDT) X-Received: by 10.99.136.65 with SMTP id l62mr19121279pgd.151.1494257235919; Mon, 08 May 2017 08:27:15 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id u73si10213210pgc.248.2017.05.08.08.27.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 May 2017 08:27:15 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-79115-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; spf=pass (google.com: domain of libc-alpha-return-79115-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-79115-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; q=dns; s= default; b=QJCBVC5EiOc1XbrT+wY73t1Jri45rDj01YyjRikdsIb+nZmlcW/HC gAEXRbkcZk5/JFy+WI7kR6P/qMxdIw2F8YcinG70iL8WUxs7s6JVgTKj+E9IY1k/ CN1j1Ih+e11VxFad3j5IOC3tuEktjLvvTe1ZNodlCYOSglXZJQnsdk= 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; s=default; bh=GdbGEyJx/VZHS8VvgXYE9srQmzQ=; b=IkLgUTr2ugo0tUca1F0jnsKMfPzQ v35oPEuAWqCkoIZzzEE6XvgddEZyTFJCIiyHtVu9uaZYF1Ob/5OqbxqNWVwccAcC oTmhxC8egXQIvGfnBLMDbZb4Ou74UZ8oRlimH9SUgDJcL7nPQ1Swz7IqoFdFxlyf SqzlHuY+u4PfAKM= Received: (qmail 52428 invoked by alias); 8 May 2017 15:27:01 -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 52085 invoked by uid 89); 8 May 2017 15:27:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL, 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-f177.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; bh=P2jZfDgMszxeWlGxt7nRSZ/xEIJtTg5euOyzOo9xCNo=; b=qAGwE8KLDn//q1PGIjM7dNQUzCyQSkQLGJxzhI5LcFZRLmOMFpFQ+y/ZLJdyGyhUs0 u1ZvFCuI/IkP0iPPwn/HsaURx5pS+zWqr16H9PZRgpvdQh4XjGQdGwiaDrPpilKANvya mBH58gsK2VjtHKIF1S+REoKDBWVbVIxtseRToCvRa0gn/sB/bLeHQLXKx6QA3hS2uk0P Fc/GHmdyfKjNr0n76HyHxUet7WSPnOMgl8uWN/XoGKPxc5S9g2H+Yr/+k2+BbX1jHOJy xdiWLauJxu3CmspR18yp78RINAgaZHf9de2WuX2/l2eXqgjEKcrTITyc1WgGKf45e7eM LY5g== X-Gm-Message-State: AN3rC/7Raca4bnUEm/Dt2R+ml66Oy265bC4DyxN+/kHBNOqhKMMQpf+Z 3/WfYjm2v/IyY4D1Sp2CXA== X-Received: by 10.55.19.86 with SMTP id d83mr26990440qkh.196.1494257219350; Mon, 08 May 2017 08:26:59 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 1/8] Consolidate Linux close syscall generation Date: Mon, 8 May 2017 12:26:45 -0300 Message-Id: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> This patch consolidates the close Linux syscall generation on sysdeps/unix/sysv/linux/close.c. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * nptl/Makefile (CFLAGS-close.c): New flag. * sysdeps/unix/sysv/linux/close.c: New file. --- ChangeLog | 5 +++++ nptl/Makefile | 1 + sysdeps/unix/sysv/linux/close.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/close.c -- 2.7.4 diff --git a/nptl/Makefile b/nptl/Makefile index 6d48c0c..8251ac4 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -213,6 +213,7 @@ CFLAGS-connect.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-recvfrom.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-recvmsg.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-sendmsg.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-close.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-pt-system.c = -fexceptions diff --git a/sysdeps/unix/sysv/linux/close.c b/sysdeps/unix/sysv/linux/close.c new file mode 100644 index 0000000..1ac71ce --- /dev/null +++ b/sysdeps/unix/sysv/linux/close.c @@ -0,0 +1,30 @@ +/* Linux close syscall implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +/* Close the file descriptor FD. */ +int +__close (int fd) +{ + return SYSCALL_CANCEL (close, fd); +} +libc_hidden_def (__close) +strong_alias (__close, __libc_close) +weak_alias (__close, close) From patchwork Mon May 8 15:26:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 98827 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1382961qge; Mon, 8 May 2017 08:27:32 -0700 (PDT) X-Received: by 10.84.131.129 with SMTP id d1mr85983992pld.16.1494257252511; Mon, 08 May 2017 08:27:32 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id l33si13350787pld.320.2017.05.08.08.27.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 May 2017 08:27:32 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-79116-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; spf=pass (google.com: domain of libc-alpha-return-79116-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-79116-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=flGBHyr68bkkf3mC5IcgVHda5/hkGYA 9WRiQjvwlS72i2fikzkzzA6DZZBM1jAKXJZjwfzzbt+zPCHSrKbDVxXX+uxB/wab p2AaxOnq65/OZr4NA8ySOU93gMtnJo1+hswkJ8VBQV8ncMFjYciNOizQRhqRxOP0 uImM7bpLLT5Y= 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=IzAv92QdeU0beiJ+OzYPUVUKyiI=; b=m3vjl wSdAkt1eFuKb2Q0gS7gTGtuYZaZ3YCB/e7IRIVSXOFFnC2vOIQWAMFdFX5R+qU0+ 4uiLXWUQ2u00mJQaFECv3YD8Cn/8iPmQvOMubASDk2hFIqjRBIFjkTNevHkf/fxr wrdy7ycd5n2zb7fqyp3ri8tAB6IpG2Pbri7Hfs= Received: (qmail 53446 invoked by alias); 8 May 2017 15:27:03 -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 53233 invoked by uid 89); 8 May 2017 15:27:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL, 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=EXTRA, 66, 3727 X-HELO: mail-qk0-f179.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=iWY7gAlYY2Gc4d8tTOkFNAZnYyR5nw/rE+g5NR4L7Z0=; b=SBbV0bR+r7uumxhehRCuhCql5+bAA3lvqSSU3uWoavd/m9YWzTKqMOsoDE4hyAzx52 IJ6ow+RzEAY8Tl9ul2OFsaWeDqfNwIbvrsBuqDzar3y9Poy1mBFaFJqYMrfZjgCJAV5s b8FxgODLqpPpytohyGkgBRUvQtcffzsj8O3nVSAZLLmt8iOBfb0vVvz4tmIr8iy5goJw JfhlHmH+Hpo/Qx8M2p4e+UtKWEhsWqxdvN8NyeHWj6N/dfl1B9LyfhuzVDvxyrjMLMfz EiXUK3pizyg+gDJPpvsXBonhBYnpYZYMpWa+tB8e0Z7RAJ0pCbR/lCdLO+Im7M71zh+1 USpA== X-Gm-Message-State: AODbwcBV08GF3D4KAK7I1vJ1ySNYVxhdbM0QjEjLYKATy1JYGWgXuHwg Nyh4ecjlzi4gkWHbAZS1Tw== X-Received: by 10.55.156.11 with SMTP id f11mr27488016qke.8.1494257220751; Mon, 08 May 2017 08:27:00 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 2/8] Consolidate Linux open implementation Date: Mon, 8 May 2017 12:26:46 -0300 Message-Id: <1494257212-524-2-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> References: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> This patch consolidates the open Linux syscall implementation on sysdeps/unix/sysv/linux/open{64}.c. The changes are: 1. Remove open{64} from auto-generation syscalls.list. 2. Add a new open{64}.c implementation. For architectures that define __OFF_T_MATCHES_OFF64_T the default open64 will create alias to required open symbols. 3. Use __NR_open where possible, otherwise use __NR_openat. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/generic/open.c: Remove file. * sysdeps/unix/sysv/linux/generic/open64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/open64.c: Likewise. * sysdeps/unix/sysv/linux/open.c: New file. * sysdeps/unix/sysv/linux/open64.c (__libc_open64): Use O_LARGEFILE only for __OFF_T_MATCHES_OFF64_T and add alias to open if the case. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Remove open from auto-generated list. --- ChangeLog | 9 +++++ sysdeps/unix/sysv/linux/generic/open64.c | 44 ----------------------- sysdeps/unix/sysv/linux/{generic => }/open.c | 29 ++++++--------- sysdeps/unix/sysv/linux/open64.c | 28 ++++++++++++--- sysdeps/unix/sysv/linux/wordsize-64/open64.c | 1 - sysdeps/unix/sysv/linux/wordsize-64/syscalls.list | 1 - 6 files changed, 44 insertions(+), 68 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/generic/open64.c rename sysdeps/unix/sysv/linux/{generic => }/open.c (78%) delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/open64.c -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/generic/open64.c b/sysdeps/unix/sysv/linux/generic/open64.c deleted file mode 100644 index 88312a1..0000000 --- a/sysdeps/unix/sysv/linux/generic/open64.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 2011-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#include -#include -#include -#include -#include - -/* Open FILE with access OFLAG. If O_CREAT or O_TMPFILE is in OFLAG, - a third argument is the file protection. */ -int -__libc_open64 (const char *file, int oflag, ...) -{ - int mode = 0; - - if (__OPEN_NEEDS_MODE (oflag)) - { - va_list arg; - va_start (arg, oflag); - mode = va_arg (arg, int); - va_end (arg); - } - - return SYSCALL_CANCEL (openat, AT_FDCWD, file, oflag | O_LARGEFILE, mode); -} -weak_alias (__libc_open64, __open64) -libc_hidden_weak (__open64) -weak_alias (__libc_open64, open64) diff --git a/sysdeps/unix/sysv/linux/generic/open.c b/sysdeps/unix/sysv/linux/open.c similarity index 78% rename from sysdeps/unix/sysv/linux/generic/open.c rename to sysdeps/unix/sysv/linux/open.c index 10cdbe0..9321bd4 100644 --- a/sysdeps/unix/sysv/linux/generic/open.c +++ b/sysdeps/unix/sysv/linux/open.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2011-2017 Free Software Foundation, Inc. +/* Copyright (C) 2017 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Chris Metcalf , 2011. @@ -16,12 +16,15 @@ License along with the GNU C Library. If not, see . */ -#include +#include +#include #include #include -#include + #include +#ifndef __OFF_T_MATCHES_OFF64_T + /* Open FILE with access OFLAG. If O_CREAT or O_TMPFILE is in OFLAG, a third argument is the file protection. */ int @@ -37,7 +40,11 @@ __libc_open (const char *file, int oflag, ...) va_end (arg); } +# ifdef __NR_open + return SYSCALL_CANCEL (open, file, oflag, mode); +# else return SYSCALL_CANCEL (openat, AT_FDCWD, file, oflag, mode); +# endif } libc_hidden_def (__libc_open) @@ -45,18 +52,4 @@ weak_alias (__libc_open, __open) libc_hidden_weak (__open) weak_alias (__libc_open, open) -int -__open_nocancel (const char *file, int oflag, ...) -{ - int mode = 0; - - if (__OPEN_NEEDS_MODE (oflag)) - { - va_list arg; - va_start (arg, oflag); - mode = va_arg (arg, int); - va_end (arg); - } - - return INLINE_SYSCALL (openat, 4, AT_FDCWD, file, oflag, mode); -} +#endif diff --git a/sysdeps/unix/sysv/linux/open64.c b/sysdeps/unix/sysv/linux/open64.c index 5e209ee..6ad8f77 100644 --- a/sysdeps/unix/sysv/linux/open64.c +++ b/sysdeps/unix/sysv/linux/open64.c @@ -15,10 +15,11 @@ License along with the GNU C Library; if not, see . */ -#include +#include +#include #include #include -#include + #include /* Open FILE with access OFLAG. If O_CREAT or O_TMPFILE is in OFLAG, @@ -36,8 +37,27 @@ __libc_open64 (const char *file, int oflag, ...) va_end (arg); } - return SYSCALL_CANCEL (open, file, oflag | O_LARGEFILE, mode); +#ifdef __OFF_T_MATCHES_OFF64_T +# define EXTRA_OPEN_FLAGS 0 +#else +# define EXTRA_OPEN_FLAGS O_LARGEFILE +#endif + +#ifdef __NR_open + return SYSCALL_CANCEL (open, file, oflag | EXTRA_OPEN_FLAGS, mode); +#else + return SYSCALL_CANCEL (openat, AT_FDCWD, file, oflag | EXTRA_OPEN_FLAGS, + mode); +#endif } -weak_alias (__libc_open64, __open64) + +strong_alias (__libc_open64, __open64) libc_hidden_weak (__open64) weak_alias (__libc_open64, open64) + +#ifdef __OFF_T_MATCHES_OFF64_T +strong_alias (__libc_open64, __libc_open) +strong_alias (__libc_open64, __open) +libc_hidden_weak (__open) +weak_alias (__libc_open64, open) +#endif diff --git a/sysdeps/unix/sysv/linux/wordsize-64/open64.c b/sysdeps/unix/sysv/linux/wordsize-64/open64.c deleted file mode 100644 index 0abe30e..0000000 --- a/sysdeps/unix/sysv/linux/wordsize-64/open64.c +++ /dev/null @@ -1 +0,0 @@ -/* Defined in open syscall. */ diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list index 0c60647..6549ed8 100644 --- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list +++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list @@ -6,7 +6,6 @@ readahead - readahead i:iii __readahead readahead sendfile - sendfile i:iipi sendfile sendfile64 sync_file_range - sync_file_range Ci:iiii sync_file_range creat - creat Ci:si creat creat64 -open - open Ci:siv __libc_open __open open __open64 open64 prlimit EXTRA prlimit64 i:iipp prlimit prlimit64 fanotify_mark EXTRA fanotify_mark i:iiiis fanotify_mark From patchwork Mon May 8 15:26:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 98828 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1383049qge; Mon, 8 May 2017 08:27:45 -0700 (PDT) X-Received: by 10.98.89.194 with SMTP id k63mr3662298pfj.81.1494257265760; Mon, 08 May 2017 08:27:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494257265; cv=none; d=google.com; s=arc-20160816; b=I75vcFlsxtFqLJlXrP7JAb3P7yH5bPyo9iP0CQYt7sk9o1oS7k1M8XPDhcgyU4NAfS Oer46VTITF7BELOXIJpuSuJ61lvc5QXcf2VG5z/9FmeZGpm/l7vm66EoB+HYXMvST0sQ UaCB/QMEyUl1h7zLWNF+kD7w7O7AjcrpBZDeve0YEYTstr/nceuKSTxM6/B/GkgpLtgx lMKgmMz3pJtk1YC997Zs/Hqnho+Q0AroapTV51ONVpdWbE67MMdwpe4Zh3KGSGPJtEHD KBwoSP4iA7tkjXWidNhunF/rTDhp2a2oKmkShXqxcJsdteWq0ERQWu9Qumj1W8ikO6BK 4+JQ== 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=p5P2qMGZ+4vJQoEhkenvRqhdqhijdynJJ0r752ebnLM=; b=NmWhu5CKj1oUO7qQxC75b991hF8YngJP+oqjkQTJWnFEsrpIARNuL/c4jDaqYDhZux wEutUv5+ZHFnh0G/D+7QOabNUY22RWTNMxcVR8QYb4OdeXVHRCFRpyYXIAoyobUzGKyE ulwqjFZd35K/q1j8vOC3iNjujT1+HkJPupCJLZeCL742rLrugUmdH/Z0sP4sYCY3CfgB mC+77toktT/gN+yNt4uXDh4gtVzEwKQi6GN0CmqYKPJIgMIByz6Q04V2a6adTlkajoW3 ZTJJ/kg89UF4DojRQvLVan5HUoWXe15dgE5mB/Ie/QGSAHKfUNEvSD0ogjE8jIFSKQF2 V+Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-79117-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-79117-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 1si13330237plx.288.2017.05.08.08.27.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 May 2017 08:27:45 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-79117-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; spf=pass (google.com: domain of libc-alpha-return-79117-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-79117-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=PZLdL4doQ5ZrqLaUfYC7GJ8awYZwfyF cK3GkGzOQm4ecm0Pb+7GAoWxEr2arOqOa0EPgGTU1XR8XSkPYZF3RAlM7V17dLOR qI3db7JqNDcfL4tNrL/sFXqWosAtASwXLnk8edTfRFbeNZxA/0QE/sHInXECOcST G5eq6IQ1klJ4= 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=VxlDqtHQc4/lrvFLSiRbSSebcgg=; b=N770+ yl8bP8ZIJJTAA1IOWf6eb2Y2/nieCJlejUxeG7fpuVNbtWj6i0OrvvVlHWiV1oFU 1V6Cq2HGL8ZPGMogudDpKTxgdNeFzEePLxQIQ48S9ZHB41O+PrVIeSFPvt8uVzQd pCYiV3Vj0RIzzdkb7sAvh0TW6hGgpXfJmQ3GxI= Received: (qmail 54326 invoked by alias); 8 May 2017 15:27:05 -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 54071 invoked by uid 89); 8 May 2017 15:27:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL, 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=1823, cancellation, 1820, EXTRA X-HELO: mail-qt0-f176.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=p5P2qMGZ+4vJQoEhkenvRqhdqhijdynJJ0r752ebnLM=; b=bKcRj5GuHGTBBDIhOgr9CrCjtVUrK7qEOkDDyf7AjUjzC9cmWBuWbfrPM8xikB1TSx ju1YZqQkZ5BvsRcKTXIcTjH0DC91pz/j72GmOUZNTpk4Ccl4ouB4uL/YOP2vRC0oEFel AT1vfMMDrwX2OPj501RcAqRCuDWiw/buDWRBOW9xMfu2WKzM1OX+pvg2o1DNums/MH9F VSpcURHL1Apal1vd6f45SslWA36CfWjGEGMYixQ58Tax910UIfqeqG/KICvH8z0IFc+9 9k+TFCRz7VhE3ro522HGtalpTWauAnsrlPRkZ0YlALyNP23BBbbf4XxSqewhpE/BsI6v qppg== X-Gm-Message-State: AODbwcBEkdHS2FRcZJPUzSbMs+HJXjLcBnwqGgobzmNmNx5OfYAnOQZ1 bgoi2ay4XGwyJtXEhZkBBQ== X-Received: by 10.200.51.172 with SMTP id c41mr20112083qtb.71.1494257222222; Mon, 08 May 2017 08:27:02 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 3/8] Consolidate Linux creat implementation Date: Mon, 8 May 2017 12:26:47 -0300 Message-Id: <1494257212-524-3-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> References: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> This patch consolidates the creat Linux syscall implementation on sysdeps/unix/sysv/linux/creat{64}.c. The changes are: 1. Remove creat{64} from auto-generation syscalls.list. 2. Add a new creat{64}.c implementation. For architectures that define __OFF_T_MATCHES_OFF64_T the default creat64 will create alias to required creat symbols. 3. Use __NR_creat where possible, otherwise use internal open{64} call with expected flags. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * io/Makefile (CFLAGS-creat.c): New rule. (CFLAGS-creat64.c): Likewise. * sysdeps/unix/sysv/linux/alpha/creat.c: Remove file. * sysdeps/unix/sysv/linux/generic/creat.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/creat64.c: Likewise. * sysdeps/unix/sysv/linux/creat.c: New file. * sysdeps/unix/sysv/linux/creat64.c: Likewise. * sysdeps/unix/sysv/linux/syscalls.list: Remove create from auto-generated list. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise. --- ChangeLog | 11 +++++++ io/Makefile | 2 ++ sysdeps/unix/sysv/linux/alpha/creat.c | 8 ----- sysdeps/unix/sysv/linux/{generic => }/creat.c | 17 ++++++----- sysdeps/unix/sysv/linux/creat64.c | 37 +++++++++++++++++++++++ sysdeps/unix/sysv/linux/syscalls.list | 1 - sysdeps/unix/sysv/linux/wordsize-64/creat64.c | 1 - sysdeps/unix/sysv/linux/wordsize-64/syscalls.list | 1 - 8 files changed, 60 insertions(+), 18 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/alpha/creat.c rename sysdeps/unix/sysv/linux/{generic => }/creat.c (77%) create mode 100644 sysdeps/unix/sysv/linux/creat64.c delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/creat64.c -- 2.7.4 diff --git a/io/Makefile b/io/Makefile index 95e04b2..8b1c250 100644 --- a/io/Makefile +++ b/io/Makefile @@ -80,6 +80,8 @@ include ../Rules CFLAGS-open.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-open64.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-creat.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-creat64.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-fcntl.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-poll.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-ppoll.c = -fexceptions -fasynchronous-unwind-tables diff --git a/sysdeps/unix/sysv/linux/alpha/creat.c b/sysdeps/unix/sysv/linux/alpha/creat.c deleted file mode 100644 index 7a5afed..0000000 --- a/sysdeps/unix/sysv/linux/alpha/creat.c +++ /dev/null @@ -1,8 +0,0 @@ -/* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list defines creat and - creat64 for most linux targets, but on alpha creat is not a syscall. - If we do nothing, we'll wind up with creat64 being undefined, because - the syscalls.list assumes the creat->creat64 alias was created. We - could have overridden that with a create64.c, but we might as well do - the right thing and set up creat64 as an alias. */ -#include -weak_alias(creat, creat64) diff --git a/sysdeps/unix/sysv/linux/generic/creat.c b/sysdeps/unix/sysv/linux/creat.c similarity index 77% rename from sysdeps/unix/sysv/linux/generic/creat.c rename to sysdeps/unix/sysv/linux/creat.c index 34cb210..31e0248 100644 --- a/sysdeps/unix/sysv/linux/generic/creat.c +++ b/sysdeps/unix/sysv/linux/creat.c @@ -1,6 +1,6 @@ -/* Copyright (C) 2011-2017 Free Software Foundation, Inc. +/* Linux default implementation for creat. + Copyright (C) 2017 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -18,20 +18,23 @@ #include #include + #include -#undef creat +#ifndef __OFF_T_MATCHES_OFF64_T /* Create FILE with protections MODE. */ int -creat (const char *file, mode_t mode) +__creat (const char *file, mode_t mode) { +# ifdef __NR_creat + return SYSCALL_CANCEL (creat, file, mode); +# else return __open (file, O_WRONLY | O_CREAT | O_TRUNC, mode); +# endif } +weak_alias (__creat, creat) -/* __open handles cancellation. */ LIBC_CANCEL_HANDLED (); -#if __WORDSIZE == 64 -weak_alias (creat, creat64) #endif diff --git a/sysdeps/unix/sysv/linux/creat64.c b/sysdeps/unix/sysv/linux/creat64.c new file mode 100644 index 0000000..5241085 --- /dev/null +++ b/sysdeps/unix/sysv/linux/creat64.c @@ -0,0 +1,37 @@ +/* Linux default implementation for LFS creat. + Copyright (C) 2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include + +/* Create FILE with protections MODE. */ +int +__creat64 (const char *file, mode_t mode) +{ + /* We need to pass O_LARGEFILE. */ + return __open64 (file, O_WRONLY | O_CREAT | O_TRUNC, mode); +} +weak_alias (__creat64, creat64) + +#ifdef __OFF_T_MATCHES_OFF64_T +strong_alias (__creat64, __creat) +weak_alias (__creat64, creat) +#endif + +LIBC_CANCEL_HANDLED (); diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 1a10903..f4abf3e 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -6,7 +6,6 @@ bdflush EXTRA bdflush i:ii __compat_bdflush bdflush@GLIBC_2.0:GLIBC_2.23 capget EXTRA capget i:pp capget capset EXTRA capset i:pp capset clock_adjtime EXTRA clock_adjtime i:ip clock_adjtime -creat - creat Ci:si creat create_module EXTRA create_module 3 __compat_create_module create_module@GLIBC_2.0:GLIBC_2.23 delete_module EXTRA delete_module 3 delete_module epoll_create EXTRA epoll_create i:i epoll_create diff --git a/sysdeps/unix/sysv/linux/wordsize-64/creat64.c b/sysdeps/unix/sysv/linux/wordsize-64/creat64.c deleted file mode 100644 index c106e2b..0000000 --- a/sysdeps/unix/sysv/linux/wordsize-64/creat64.c +++ /dev/null @@ -1 +0,0 @@ -/* Defined as alias for the syscall. */ diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list index 6549ed8..5c78677 100644 --- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list +++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list @@ -5,7 +5,6 @@ statfs - statfs i:sp __statfs statfs statfs64 readahead - readahead i:iii __readahead readahead sendfile - sendfile i:iipi sendfile sendfile64 sync_file_range - sync_file_range Ci:iiii sync_file_range -creat - creat Ci:si creat creat64 prlimit EXTRA prlimit64 i:iipp prlimit prlimit64 fanotify_mark EXTRA fanotify_mark i:iiiis fanotify_mark From patchwork Mon May 8 15:26: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: 98829 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1383159qge; Mon, 8 May 2017 08:28:02 -0700 (PDT) X-Received: by 10.98.18.157 with SMTP id 29mr4844810pfs.75.1494257282267; Mon, 08 May 2017 08:28:02 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id q78si9935515pgq.344.2017.05.08.08.28.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 May 2017 08:28:02 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-79118-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; spf=pass (google.com: domain of libc-alpha-return-79118-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-79118-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=Rz2PC5W8b62CC+U15/0ByNe5PeDxmGA PwsfZYia5MU4YurpfMkGpq08qp5JnYk5ES6Gc9KPof6RKDuSKOvl8r2IcgCfC4z7 FOBHMprk6sBZrZ2zTc6WSNwH2gUgjcxFL/7fd2Ple8vHpOqq8E4seCI1sWReOwie hwVC+9HMxBlw= 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=WF+nDRhmDL3AXXIKSanZXO3SmrE=; b=BM3IY M4n/mpOsVNPJkUO5dBKZEcfGAKgYKzRbxzHAVSTagvWYhVRKSgB3iVqExG0QcpBn lPd0RX0KhAZO2mcsJNUjPwVGHiF3Bmlhr85INXb5GzF3ijXSCKkAvMUNQ4CGKMXi V0MShzIOPPatlK286N68gUuBMuW0QGhvbmTFNA= Received: (qmail 54491 invoked by alias); 8 May 2017 15:27:05 -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 54162 invoked by uid 89); 8 May 2017 15:27:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=5, 6 X-HELO: mail-qt0-f175.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=pMhH4WrHgXjA+deFZtmTaXM+ftdXOWKPiP/RnSMwZxI=; b=jCi8lIhNshif9saneuQl9N5fYc6fmA5OM5wFQIiygG7SNd8JHdzpJodVswKM2Ztm+U aNAfsgO6TzwtCxe2Nv+/wloI6SZ8q240LclZy292717YigDNAE8sS8ZuN8hIH6YcaL3W 3K1O1xJt9IBWWMjfe4PoGUhnocmzzIKMT3gYiDMuaR86tL2KG2OEmWCZN+veD7U55LBi YHr/OfM0LXJHM3S0GEVK+M1osDTkB9xT7nWSLoOrDeuFXRxNU7vJ/7aT0gUAWSzx7bhe rBGjbfxpCUGKWUKM67EOl+s2JBPYEctOhMMpcHwLYaXVsm9y2vx5rwCGEHUcU714uW9k 80Bg== X-Gm-Message-State: AODbwcBwAVuR2XyZ6reUq3xR/H8CoHIBL6OULkqsY5p1QuSXQpWqz8q5 X0RbPzPrT9jpNCE91kYmnQ== X-Received: by 10.237.37.55 with SMTP id v52mr19019605qtc.31.1494257223544; Mon, 08 May 2017 08:27:03 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 4/8] Consolidate Linux read syscall Date: Mon, 8 May 2017 12:26:48 -0300 Message-Id: <1494257212-524-4-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> References: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> This patch consolidates the read Linux syscall implementation on sysdeps/unix/sysv/linux/read.c. This leads to a different frame pointer creation on some architectures: * It fixes BZ#21428 on aarch64, since now the returned address for the read syscall can be correctly found out by backtrace_symbols. * It makes tst-backtrace{5,6} fails on powerpc due an issue on its custom backtrace implementation. It is fixed on last patch from this set. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. [BZ #21428] * include/unistd.h (read): Add hidden proto. * io/Makefile (CFLAGS-read.c): New rule. * nptl/Makefile (CFLAGS-read.c): New rule. * sysdeps/unix/sysv/linux/read.c: New file. --- ChangeLog | 4 ++++ include/unistd.h | 1 + io/Makefile | 1 + nptl/Makefile | 1 + sysdeps/unix/sysv/linux/read.c | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 40 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/read.c -- 2.7.4 diff --git a/include/unistd.h b/include/unistd.h index f36759b..01556d3 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -53,6 +53,7 @@ extern ssize_t __libc_pwrite64 (int __fd, const void *__buf, size_t __n, __off64_t __offset) attribute_hidden; extern ssize_t __libc_read (int __fd, void *__buf, size_t __n); libc_hidden_proto (__libc_read) +libc_hidden_proto (read) extern ssize_t __libc_write (int __fd, const void *__buf, size_t __n); libc_hidden_proto (__libc_write) extern int __pipe (int __pipedes[2]); diff --git a/io/Makefile b/io/Makefile index 8b1c250..db14c0d 100644 --- a/io/Makefile +++ b/io/Makefile @@ -100,6 +100,7 @@ CFLAGS-posix_fallocate64.c = -fexceptions CFLAGS-fallocate.c = -fexceptions CFLAGS-fallocate64.c = -fexceptions CFLAGS-sync_file_range.c = -fexceptions +CFLAGS-read.c = -fexceptions CFLAGS-test-stat.c = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE CFLAGS-test-lfs.c = -D_LARGEFILE64_SOURCE diff --git a/nptl/Makefile b/nptl/Makefile index 8251ac4..faabd45 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -214,6 +214,7 @@ CFLAGS-recvfrom.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-recvmsg.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-sendmsg.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-close.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-read.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-pt-system.c = -fexceptions diff --git a/sysdeps/unix/sysv/linux/read.c b/sysdeps/unix/sysv/linux/read.c new file mode 100644 index 0000000..2a02c1b --- /dev/null +++ b/sysdeps/unix/sysv/linux/read.c @@ -0,0 +1,33 @@ +/* Linux read syscall implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +/* Read NBYTES into BUF from FD. Return the number read or -1. */ +ssize_t +__libc_read (int fd, void *buf, size_t nbytes) +{ + return SYSCALL_CANCEL (read, fd, buf, nbytes); +} +libc_hidden_def (__libc_read) + +libc_hidden_def (__read) +weak_alias (__libc_read, __read) +libc_hidden_def (read) +weak_alias (__libc_read, read) From patchwork Mon May 8 15:26:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 98830 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1383226qge; Mon, 8 May 2017 08:28:12 -0700 (PDT) X-Received: by 10.99.119.76 with SMTP id s73mr19154944pgc.215.1494257292763; Mon, 08 May 2017 08:28:12 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id j1si1212576pld.54.2017.05.08.08.28.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 May 2017 08:28:12 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-79119-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; spf=pass (google.com: domain of libc-alpha-return-79119-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-79119-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=mNqXzh7Sh3836UfsIjmvgNrViicim2E 2PGS3q8ztkFJSbgmN3giZTMn9tS/ZxKKVmiXUcRj3z8KTMcSMVawFRg+5Fq6mi/7 ICmAqonNF0OfcDXR4LoucD4XsavWQQ5i8fMZyRd8FCasar+pSCDuPgVy/19Pr17D DjhFf5Gh0+zc= 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=xMYn5Jq/HlTcllaYWS/o0Vb7xt4=; b=anky3 jwFskq5IzA/8DGmk8nYdnR/aS8qYh+ytR8QCN4XXTrJafEaDctH91zspBdPLI/wN mstn5xp4mpsxh2HXHxHkRFxkVIu1EVrNeGuTU5TjVUH1CHEcrV12K+MIi1HJEZgu J3nfR9F1KFGGIMXOVraqpY4Ih1qQ2GTXd+qZZ8= Received: (qmail 55312 invoked by alias); 8 May 2017 15:27:07 -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 54963 invoked by uid 89); 8 May 2017 15:27:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Received:10.237.48.66 X-HELO: mail-qt0-f180.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=hfK1W/9a279QVCdr0ibeUilW38UkoMXfqW7Vxefn5kw=; b=XJc8HgkIdVrytzB31pcvw1bga+3RflfnnK2zzbs4FBY+XSVzm8cd75ZtYxTogPUWV4 eKmvDwHqvgVepOt94O29yVGjW9mcVhXiaa8F36g6tYsCH/Px14H8mvt/wkEwMNFd7Dxl k4yIfY9N4ZhbSBQXHwD12g9+n3NLUl6Xf9Md1cPTmCUnxOx+NzAqAhv9gKnhzugH6K++ J0fT2eaU9ElTwv4P5dCEpOmsXnWJHoCepE9Pe86vy0SeAP514JE0Wk1omR8QCzTLSp9w 8Cct6ea6J6R6FxB5gNGFHuBqpf2TvbZ01xAXNoacxwnQ1HkI1TMLBy4fluDB2K6Ekvu5 QqJQ== X-Gm-Message-State: AN3rC/4OTr1fsv1c7OrY4/tcQp+UrvbOT+ViMDUqkqXjV25hFXkQoCXl oCpau8eo8z1hOpfsb32VUg== X-Received: by 10.237.48.66 with SMTP id 60mr61430961qte.25.1494257224988; Mon, 08 May 2017 08:27:04 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 5/8] Consolidate Linux write syscall Date: Mon, 8 May 2017 12:26:49 -0300 Message-Id: <1494257212-524-5-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> References: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> This patch consolidates the write Linux syscall implementation on sysdeps/unix/sysv/linux/write.c. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * io/Makefile (CFLAGS-write.c): New rule. * nptl/Makefile (CFLAGS-write.c): Likewise. * sysdeps/unix/sysv/linux/write.c: New file. --- ChangeLog | 4 ++++ include/unistd.h | 1 + io/Makefile | 1 + nptl/Makefile | 1 + sysdeps/unix/sysv/linux/write.c | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 40 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/write.c -- 2.7.4 diff --git a/include/unistd.h b/include/unistd.h index 01556d3..0cdf06e 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -56,6 +56,7 @@ libc_hidden_proto (__libc_read) libc_hidden_proto (read) extern ssize_t __libc_write (int __fd, const void *__buf, size_t __n); libc_hidden_proto (__libc_write) +libc_hidden_proto (write) extern int __pipe (int __pipedes[2]); libc_hidden_proto (__pipe) extern int __pipe2 (int __pipedes[2], int __flags); diff --git a/io/Makefile b/io/Makefile index db14c0d..16365e5 100644 --- a/io/Makefile +++ b/io/Makefile @@ -101,6 +101,7 @@ CFLAGS-fallocate.c = -fexceptions CFLAGS-fallocate64.c = -fexceptions CFLAGS-sync_file_range.c = -fexceptions CFLAGS-read.c = -fexceptions +CFLAGS-write.c = -fexceptions CFLAGS-test-stat.c = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE CFLAGS-test-lfs.c = -D_LARGEFILE64_SOURCE diff --git a/nptl/Makefile b/nptl/Makefile index faabd45..5b34b5c 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -215,6 +215,7 @@ CFLAGS-recvmsg.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-sendmsg.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-close.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-read.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-write.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-pt-system.c = -fexceptions diff --git a/sysdeps/unix/sysv/linux/write.c b/sysdeps/unix/sysv/linux/write.c new file mode 100644 index 0000000..d495145 --- /dev/null +++ b/sysdeps/unix/sysv/linux/write.c @@ -0,0 +1,33 @@ +/* Linux write syscall implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +/* Write NBYTES of BUF to FD. Return the number written, or -1. */ +ssize_t +__libc_write (int fd, const void *buf, size_t nbytes) +{ + return SYSCALL_CANCEL (write, fd, buf, nbytes); +} +libc_hidden_def (__libc_write) + +weak_alias (__libc_write, __write) +libc_hidden_weak (__write) +weak_alias (__libc_write, write) +libc_hidden_weak (write) From patchwork Mon May 8 15:26:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 98831 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1383318qge; Mon, 8 May 2017 08:28:23 -0700 (PDT) X-Received: by 10.99.124.13 with SMTP id x13mr18889838pgc.81.1494257303428; Mon, 08 May 2017 08:28:23 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id a1si10271962pgf.55.2017.05.08.08.28.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 May 2017 08:28:23 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-79120-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; spf=pass (google.com: domain of libc-alpha-return-79120-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-79120-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=mYyNifrXqjBM7u4Ag6T77+UHIUk/hR3 03GPiMumaWnNMcfuKrcYak+esBW2L7HbKklskbIDdfhAGPSMiU/tD/nOwzAO5DVH ok97klJbAJHBvm3FiCyDMBBZoo6mtRsTIzIImDjNjyr6Ys5/oUFlq2ORFru5i8VB DoInMyOILNSY= 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=Ni3/Tw54AKAqUM92t6tyxEc8v0Y=; b=IPPCY hoKCxsJjwFLEtvuDpfTN+vM3aOSAzUYy2Zn9CB6lCLoHo/TgDj2ZHgkxkCCWUoEE PHB1jw0dyKe3WR9u1pBVjvnUrruxTrphjtyhWfvkjgJ7Cc9IAkYSB7MMfoZWVaXJ Peh+nBplqvsRGKI/alF5+ODjR+CrJ7ABMVgXBA= Received: (qmail 55738 invoked by alias); 8 May 2017 15:27:08 -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 55490 invoked by uid 89); 8 May 2017 15:27:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1721 X-HELO: mail-qt0-f174.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=GUdAIGliDUtS4eNl/cTFDdP0aPLL2al+dFB8AAHk+AY=; b=fPoKatTozanhxNDvr7uZh9Ylfb79xYNFversPVIsIKbOnJ41JTexwz+Bn3cEFz13mf gUBmkThLlDhiXkAK/+ZGGc4o1CYZufUY68aREW8z8v8FDqdFDmPuR+++Z9qWBQtLUQSY 3qqiO2CLmSFwtNy0eJZ0uCTx4SqGc7EtjzNSPhJU+buYs1Gn2JGD8qFFFUKoTOkYL0io Sc6PS2uw/wsK8htGD+KUyvy8F7w//NDeaAx0sKqhW3KB2qDoilLIi7NKI6TdJryXkGFx ojHdz0e7tyR+TeVGzmSpmqukuYtcI8n7zRWPT1LuNyv9YIIjMT0tV2B40O4kHMqqpcSU QZ5g== X-Gm-Message-State: AODbwcCE2jNXW83prOOgyjkArK2omIzWzieK5CADjYC8aPdd8z0LjEBj wTJuoR1eYBw1CjA2W7Drgg== X-Received: by 10.237.37.81 with SMTP id w17mr20605587qtc.8.1494257226342; Mon, 08 May 2017 08:27:06 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 6/8] Consolidate Linux readv implementation Date: Mon, 8 May 2017 12:26:50 -0300 Message-Id: <1494257212-524-6-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> References: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> This patch consolidates the readv Linux syscall implementation on sysdeps/unix/sysv/linux/readv.c. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/readv.c: New file. --- ChangeLog | 2 ++ sysdeps/unix/sysv/linux/readv.c | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/readv.c -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c new file mode 100644 index 0000000..142a0a9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/readv.c @@ -0,0 +1,27 @@ +/* Linux implementation for readv syscall. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +ssize_t +__readv (int fd, const struct iovec *iov, int iovcnt) +{ + return SYSCALL_CANCEL (readv, fd, iov, iovcnt); +} +weak_alias (__readv, readv) From patchwork Mon May 8 15:26:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 98832 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1383394qge; Mon, 8 May 2017 08:28:33 -0700 (PDT) X-Received: by 10.99.4.3 with SMTP id 3mr19302478pge.86.1494257313644; Mon, 08 May 2017 08:28:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494257313; cv=none; d=google.com; s=arc-20160816; b=rxypz703hp1Rg/HReX0upV9grnFwKe3JQaO1GyAbFaCN+sERJXWSnlwiueL4AEDwZo noHm6JuvuYnhwB9TSIKLG/aVLjA2DWFz3cspSF4pW6LthAHp5f7sQWRVsYjOzpxJuhMl J6twor3ZzmGxaLoj8tr6yxvVbzbbtPTBG4MCgjHtlhmW7GeZKIFE5zaB4CJk3cuVgAFL IVusuqBfLce5Y1XKczrTsIoyjt1vQLLOt8KrWtHHxyK7Ycu+qxxPrPiVdsnyERcsfBUV 7+ypEy72729xNCkczaDOsT/jTjt3Nvy8mxzvdM59F+1GaQkDkkyWiemjSepcOwO9kpnu zFhg== 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=4p+EK8b5YcuaGlj+SGXuaEUDI4AW5O033Zidgs3a5H0=; b=zs4+9x/ugCV3OeHBs0J0+zeE+6EulFWt2ZwZ2Y092Hy3t6I3Ss1zzXGG32dGloIg5J VoI1gsBX4/AEdlutgs1F8oGHNtzdazwgg1G+3NwOmeW7o0eqCPPPdCleY5NkchBNNxGr cKRSzT9DRemLx0+qqyEFkCNyP6OlkRDoEnC3Vv4Dw9HKINUIqKrwrth84bqJxGibc81g VzU3b2NjRyY0ZnQw2fb04ibK06sDWd41BYhsQs2c8F9H91h9gV6d/AkujvWokN+CFH5i CWCM67BCZO0l4cHS8qf6ijfZvUqLZDh9lNJOkmnxwNNsiV38kE7fh7Y8UkmyCFGV6z7u axUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-79121-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-79121-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 z14si10208954pgo.252.2017.05.08.08.28.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 May 2017 08:28:33 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-79121-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; spf=pass (google.com: domain of libc-alpha-return-79121-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-79121-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=Sp+t+wafxOsfHbbdMii/jfcyVD65IbV y3xLHCYewn5GgvU/L5JX8JNNAkoe2PkZ+BLsAyn5PcjViKFEHAkOOahQ4RKgGX/H BUTaozQVHHOjwYAaMSe6quOsj3kAr+66bb1v+3mTi5CZ30FI7bUsMfZszog5aCBP 0/MJA9vDhy2s= 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=KztV8sYVXWceSGVrTlno6hEo5G0=; b=jrxTr oIbulYmTKu3G8JSy4w073VYPMSTR+o1Uo1su8Ao482mLobmjZsyDwEebyMLam6wV jXSVXe/0u+X4OTDxay6WJAjEX3BsABTU45nfL79V+OuK1eHD9Sm7o+BWDbJVelGB xaxBCTkM85svufrQrT4TyVx47PZJRqGxFrv5XY= Received: (qmail 56616 invoked by alias); 8 May 2017 15:27:10 -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 56184 invoked by uid 89); 8 May 2017 15:27:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL, 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-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=4p+EK8b5YcuaGlj+SGXuaEUDI4AW5O033Zidgs3a5H0=; b=ZcK564KzKaz45W8rvLFNLiltjAkiE7cNNLE9DVbI/Rv/oe5V83LT5lPfsguBHWlGoJ lkJU7wp4B54aI9K9sqyD9ttm7XrXLy0cp04bxdxfxQ5bYAzmaIOAU/jNwjcCzljAab1L DoXB2mVIW3hgc4wLMBbwL8SvVJku25OSCKhYkeH1LDfdqEVms7FUl7FNgz751QPINpoj +iOYpZ9GV6cwe+bzYcC2QNbyzJvwUrj8VBijv10i/3PG3MeNDwmsSEq6Zdj/yRQZ5CX+ UyDwuZPx6NwguS+NrnCzKfNiaYqRlrxc8ng2OPLFrn/m3MQpPwtHD3qEHum/Dub+PiBI CNZA== X-Gm-Message-State: AN3rC/5fzkxbzIiJvZg7+D+gFQGE7cXXTpmdjn4Vgtu8mIJQW9YCeYBh C9OL0IHSitWUonhlpe9TyQ== X-Received: by 10.200.55.145 with SMTP id d17mr27757664qtc.57.1494257227785; Mon, 08 May 2017 08:27:07 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 7/8] Consolidate Linux writev implementation Date: Mon, 8 May 2017 12:26:51 -0300 Message-Id: <1494257212-524-7-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> References: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> This patch consolidates the writev Linux syscall implementation on sysdeps/unix/sysv/linux/writev.c. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/writev.c: New file. --- ChangeLog | 2 ++ sysdeps/unix/sysv/linux/writev.c | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/writev.c -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/writev.c b/sysdeps/unix/sysv/linux/writev.c new file mode 100644 index 0000000..1b56cbb --- /dev/null +++ b/sysdeps/unix/sysv/linux/writev.c @@ -0,0 +1,27 @@ +/* Linux writev syscall implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +ssize_t +__writev (int fd, const struct iovec *iov, int iovcnt) +{ + return SYSCALL_CANCEL (writev, fd, iov, iovcnt); +} +weak_alias (__writev, writev) From patchwork Mon May 8 15:26:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 98833 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1383479qge; Mon, 8 May 2017 08:28:46 -0700 (PDT) X-Received: by 10.99.106.5 with SMTP id f5mr18799947pgc.66.1494257326397; Mon, 08 May 2017 08:28:46 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id m63si12813402pld.109.2017.05.08.08.28.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 May 2017 08:28:46 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-79122-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; spf=pass (google.com: domain of libc-alpha-return-79122-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-79122-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=ssLDCKbV69uvszhWKgkgStthGq3y9Fk 4xdKL2z9dz5/dLyRsVscB67/CP1HJ2XB3IomWFE+1U3lAUOlBVQ+zEs/fTB3cGSg ifrpX1hjTru2KfZqkcACY2L3YRUmYgQNidZPrF2I25g8hhI0TVHQ1xq1qyYvYkWW OruFXdQQzgo4= 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=qSpRTEUvPsket9BfFM8XUSCpD9E=; b=ledj5 D/OmrKLkAaaIzxZbJ3tRqtfjv63BqdBwvslscgd4wTorTJ2r+pgy/dMJ9HZ1LF1F jozVhHDIvX1dRkFJ/tuAtVR+IRsXLCf0rBwIZrAxTBU1XqZyNnXAlmcTH4YqyaxE OZT4GyoIUVPhH2nmnwaOUiS0NgypDXhEH3oss0= Received: (qmail 57505 invoked by alias); 8 May 2017 15:27:12 -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 57279 invoked by uid 89); 8 May 2017 15:27:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=nip, stdinth, stdint.h, UD:stdint.h X-HELO: mail-qt0-f175.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=GfhRG9te2n936kDJiH7r3PNs4s9rlDvwgt1zNoTC1W0=; b=P+dpGlyFCa0Qxf0difgRbmGiNUhwoGdKVbGnnEBHMvS44WliH9zTX/Na2+4/MEJavF tyXoV1wyHIYHgZNp52MTUA+xArOp4Ntpbb+/h4fjIGSJAyP1v6Vbx2FP96eOMM0nhgYq Z4hZZUCztwMc+MlAhvd4gQ9Z6udJF2jpsO9TJS6oIwnwmhb1kLINn7WKXFJluel+Spxu G0Akj+uGRxKfbsALS2SPgXwIYGruSfBFpaxM+pYTzZpK+qSBfXDQUCp9jdXuTycixBUn v6JGA4paZJ/boAvRZ7zw5oq3G3Znk7+kDmKfnBhKruHasqoGOKfsEiuXKNqxJ0bGtE8b fRxQ== X-Gm-Message-State: AN3rC/74PYV5wGoQZmVIoNdmTvSZnW9xrtcAONL5LiLhdFQJgB79vt+c hSJIBvv/2t8BCL5aUmHjHA== X-Received: by 10.200.56.243 with SMTP id g48mr30737426qtc.79.1494257229258; Mon, 08 May 2017 08:27:09 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 8/8] powerpc: Fix signal handling in backtrace Date: Mon, 8 May 2017 12:26:52 -0300 Message-Id: <1494257212-524-8-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> References: <1494257212-524-1-git-send-email-adhemerval.zanella@linaro.org> Now with read consolidation which uses SYSCALL_CANCEL macro, a frame pointer is created in the syscall code and this makes the powerpc backtrace obtain a bogus entry for the signal handling patch. It is because it does not setup the correct frame pointer register (r1) based on the saved value from the kernel sigreturn. It was not failing because the syscall frame pointer register was the same one for the next frame (the function that actually called the syscall). This patch fixes it by setup the next stack frame using the saved one by the kernel sigreturn. It fixes tst-backtrace{5,6} after the read consolidation patch. Checked on powerpc-linux-gnu and powerpc64le-linux-gnu. * sysdeps/powerpc/powerpc32/backtrace.c (is_sigtramp_address): Use void* for argument type and use VDSO_SYMBOL macro. (is_sigtramp_address_rt): Likewise. (__backtrace): Setup expected frame pointer address for signal handling. * sysdeps/powerpc/powerpc32/backtrace.c (is_sigtramp_address): Use void* for argumetn type and use VSDO_SYMBOL macro. (__backtrace): Setup expected frame pointer address for signal handling. --- ChangeLog | 10 ++++++++++ sysdeps/powerpc/powerpc32/backtrace.c | 17 ++++++++++------- sysdeps/powerpc/powerpc64/backtrace.c | 17 ++++++++++------- 3 files changed, 30 insertions(+), 14 deletions(-) -- 2.7.4 diff --git a/ChangeLog b/ChangeLog index bc97d16..dcda6c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2016-05-08 Adhemerval Zanella + * sysdeps/powerpc/powerpc32/backtrace.c (is_sigtramp_address): Use + void* for argument type and use VDSO_SYMBOL macro. + (is_sigtramp_address_rt): Likewise. + (__backtrace): Setup expected frame pointer address for signal + handling. + * sysdeps/powerpc/powerpc32/backtrace.c (is_sigtramp_address): Use + void* for argumetn type and use VSDO_SYMBOL macro. + (__backtrace): Setup expected frame pointer address for signal + handling. + * sysdeps/unix/sysv/linux/writev.c: New file. * sysdeps/unix/sysv/linux/readv.c: New file. diff --git a/sysdeps/powerpc/powerpc32/backtrace.c b/sysdeps/powerpc/powerpc32/backtrace.c index b60ac32..3940621 100644 --- a/sysdeps/powerpc/powerpc32/backtrace.c +++ b/sysdeps/powerpc/powerpc32/backtrace.c @@ -52,10 +52,10 @@ struct signal_frame_32 { }; static inline int -is_sigtramp_address (unsigned int nip) +is_sigtramp_address (void *nip) { #ifdef SHARED - if (nip == (unsigned int)__vdso_sigtramp32) + if (nip == VDSO_SYMBOL (sigtramp32)) return 1; #endif return 0; @@ -69,10 +69,10 @@ struct rt_signal_frame_32 { }; static inline int -is_sigtramp_address_rt (unsigned int nip) +is_sigtramp_address_rt (void * nip) { #ifdef SHARED - if (nip == (unsigned int)__vdso_sigtramp_rt32) + if (nip == VDSO_SYMBOL (sigtramp_rt32)) return 1; #endif return 0; @@ -100,20 +100,23 @@ __backtrace (void **array, int size) /* Check if the symbol is the signal trampoline and get the interrupted * symbol address from the trampoline saved area. */ - if (is_sigtramp_address ((unsigned int)current->return_address)) + if (is_sigtramp_address (current->return_address)) { struct signal_frame_32 *sigframe = (struct signal_frame_32*) current; gregset = &sigframe->mctx.gregs; } - else if (is_sigtramp_address_rt ((unsigned int)current->return_address)) + else if (is_sigtramp_address_rt (current->return_address)) { struct rt_signal_frame_32 *sigframe = (struct rt_signal_frame_32*) current; gregset = &sigframe->uc.uc_mcontext.uc_regs->gregs; } if (gregset) - array[++count] = (void*)((*gregset)[PT_NIP]); + { + array[++count] = (void*)((*gregset)[PT_NIP]); + current = (void*)((*gregset)[PT_R1]); + } } /* It's possible the second-last stack frame can't return diff --git a/sysdeps/powerpc/powerpc64/backtrace.c b/sysdeps/powerpc/powerpc64/backtrace.c index 83b963e..723948d 100644 --- a/sysdeps/powerpc/powerpc64/backtrace.c +++ b/sysdeps/powerpc/powerpc64/backtrace.c @@ -16,10 +16,12 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, see . */ -#include #include #include #include +#include + +#include #include /* This is the stack layout we see with every stack frame. @@ -37,7 +39,7 @@ struct layout { struct layout *next; - long condition_register; + long int condition_register; void *return_address; }; @@ -47,16 +49,16 @@ struct layout dummy frame to make it look like it has a caller. */ struct signal_frame_64 { #define SIGNAL_FRAMESIZE 128 - char dummy[SIGNAL_FRAMESIZE]; + char dummy[SIGNAL_FRAMESIZE]; struct ucontext uc; /* We don't care about the rest, since the IP value is at 'uc' field. */ }; static inline int -is_sigtramp_address (unsigned long nip) +is_sigtramp_address (void *nip) { #ifdef SHARED - if (nip == (unsigned long)__vdso_sigtramp_rt64) + if (nip == VDSO_SYMBOL (sigtramp_rt64)) return 1; #endif return 0; @@ -82,10 +84,11 @@ __backtrace (void **array, int size) /* Check if the symbol is the signal trampoline and get the interrupted * symbol address from the trampoline saved area. */ - if (is_sigtramp_address ((unsigned long)current->return_address)) + if (is_sigtramp_address (current->return_address)) { struct signal_frame_64 *sigframe = (struct signal_frame_64*) current; - array[++count] = (void*)sigframe->uc.uc_mcontext.gp_regs[PT_NIP]; + array[++count] = (void*) sigframe->uc.uc_mcontext.gp_regs[PT_NIP]; + current = (void*) sigframe->uc.uc_mcontext.gp_regs[PT_R1]; } }