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: 693362 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tF8Xx4S8Wz9t1h for ; Fri, 11 Nov 2016 04:04:33 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="THxFmlSk"; dkim-atps=neutral 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=Lk4iS052N3GfcrM2FhrRN2s9EYbIHOHK88x6d/AyesKb6OjKRSFVD jzAgK0oH8gU4qoO1vK9MDsdiJZplJwnRsRsApqFBZJaIhwcc2NbZsKnf8f6b2Lsn ePDOmhS5VfXuHf8svvCXToY7m31zN/36nweCvIB3S75qUb8rP6z5AE= 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=THxFmlSkhHMLVmte4ieuYeCPGWZq PCydNkLxGa5FMO7wjf2kFKVg6vuhWM/WylDiWkIsjgwJ5fLEqu4PtaLxouQr7quE ByA5IWpAOlNlq5UM3GBwUW3Av3Hj4NSKaWQs6sokVVejVYSgGW+UehYd1br3Bdiv uKdJAruaJn5RaEI= 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 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)