From patchwork Thu Nov 10 17:04:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 81707 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp832523qge; Thu, 10 Nov 2016 09:04:35 -0800 (PST) X-Received: by 10.107.170.230 with SMTP id g99mr7757588ioj.111.1478797475847; Thu, 10 Nov 2016 09:04:35 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id sw5si4942292pab.73.2016.11.10.09.04.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Nov 2016 09:04:35 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-74650-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-74650-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-74650-patch=linaro.org@sourceware.org; dmarc=fail (p=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=DlYr+rRjEwIDQW9crcx/convY62+d2k23NcBcNCVN+ajJVdKSwuOC exKdzjDJ1vjYZ/tvd9pv1L+7XvnuKpla1bVdxRGUmKVzknaP+Xc5CVX7QAF4Ir4x Djs7OIJSzr/1Sd7UFVq6A4v6UuQnoEO1Sg1nBHi/EHqHfoefIcRdcU= 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=Wf2zp+9L2xvrECoJ5FjarzJ0ok0=; b=QrWd3XzyX23MaMmiHnYAI+FnKYxd L7w1ZEP85h4mlVigW9i5uYlj0jDBrPrIxILZsDjXZ9TJARgxptbv4qbI8QDDPA3G tMdAz8OC37Si/hOiv2FBv6LGWFkekBYJMSDpFr/YjgNEzlvvIlk0WpPXXn5ddC8l ohz42R7cVHL2sBA= Received: (qmail 46347 invoked by alias); 10 Nov 2016 17:04:26 -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 46334 invoked by uid 89); 10 Nov 2016 17:04:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=consolidates, access.c, accessc, UD:access.c X-HELO: mail-vk0-f51.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=N6dYKcEAp0wTec7GYZrkT12FPDdEvSxPoIvgxTyfTPk=; b=F+zuP7iyUGGAK6NrR8HDZiIYhoHt8X3R54n7yb+7BP72ZUWy3a1+sNkt+qsKJjSSE9 c59mkXdNf3AXPkDJ4rDHbvsYkt6us2JogmHiM53WmkFNYPK+YOOBGnFZbWlyjw0+s+Dc u0IyunLvrDEXXfur3UibDzsnykLiPcKCBw/DLfR6E3cN/weMkVzDuGiJG4/jzniDapq/ z2o3JLWGLIkFhiDbWM1BtC7Cs13cx/Khok0ry2+eha32ZAqu62KFgyn6f34vTHMi7FNf Zj4zpuk1QOGwvmkwMAz0yIGIRWW9Jx26IIILea6ukruLbNrre3x6oPdknjXG8qRCROyS E5MQ== X-Gm-Message-State: ABUngvftNKGWj0eyup3koFo9Qkj6+nr1NP1Sajc7XSJNO9YVw7lE3o0MayCMOv74b6FdZJ1r X-Received: by 10.31.197.194 with SMTP id v185mr4128555vkf.84.1478797453444; Thu, 10 Nov 2016 09:04:13 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 1/2] Consolidate Linux access implementation Date: Thu, 10 Nov 2016 15:04:05 -0200 Message-Id: <1478797446-12213-1-git-send-email-adhemerval.zanella@linaro.org> This patch consolidates the Linux access implementation on sysdeps/unix/sysv/linux/access.c. Similar to auto-generation through syscalls.list, __NR_access is check and __NR_faccessat is used only for newer architectures (where __NR_access is not defined). Checked on x86_64. * sysdeps/unix/sysv/linux/access.c: New file. * sysdeps/unix/sysv/linux/generic/access.c: Remove file. --- ChangeLog | 5 +++++ sysdeps/unix/sysv/linux/access.c | 32 ++++++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/generic/access.c | 31 ------------------------------- 3 files changed, 37 insertions(+), 31 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/access.c delete mode 100644 sysdeps/unix/sysv/linux/generic/access.c -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/access.c b/sysdeps/unix/sysv/linux/access.c new file mode 100644 index 0000000..cdb7908 --- /dev/null +++ b/sysdeps/unix/sysv/linux/access.c @@ -0,0 +1,32 @@ +/* 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 + +/* Test for access to FILE. */ +int +__access (const char *file, int type) +{ +#ifdef __NR_access + return INLINE_SYSCALL_CALL (access, file, type); +#else + return INLINE_SYSCALL_CALL (faccessat, AT_FDCWD, file, type); +#endif +} +weak_alias (__access, access) diff --git a/sysdeps/unix/sysv/linux/generic/access.c b/sysdeps/unix/sysv/linux/generic/access.c deleted file mode 100644 index 586aa93..0000000 --- a/sysdeps/unix/sysv/linux/generic/access.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2011-2016 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 - -/* Test for access to FILE. */ -int -__access (const char *file, int type) -{ - return INLINE_SYSCALL (faccessat, 3, AT_FDCWD, file, type); -} -weak_alias (__access, access)