]> sourceware.org Git - glibc.git/commitdiff
Consolidate Linux access implementation
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 10 Nov 2016 11:24:34 +0000 (09:24 -0200)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 10 Nov 2016 18:38:07 +0000 (16:38 -0200)
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
sysdeps/unix/sysv/linux/access.c [moved from sysdeps/unix/sysv/linux/generic/access.c with 77% similarity]

index 484fff83c5996f9f782de5f1dc70e05ed7c545c9..4b93266e8846bfbd6c6ed8b02a1201c336981e4e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-10  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+       * sysdeps/unix/sysv/linux/access.c: New file.
+       * sysdeps/unix/sysv/linux/generic/access.c: Remove file.
+
 2016-11-10  Steve Ellcey  <sellcey@caviumnetworks.com>
 
        * sysdeps/tile/tilepro/bits/wordsize.h: Define __WORDSIZE32_SIZE_ULONG
similarity index 77%
rename from sysdeps/unix/sysv/linux/generic/access.c
rename to sysdeps/unix/sysv/linux/access.c
index 586aa937578b25c02bbbbfc99f0c447591dbd388..8f003df27c7aaaa446364213a4cdd5c0f2e8055a 100644 (file)
@@ -1,6 +1,6 @@
-/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
+/* Linux implementation for access function.
+   Copyright (C) 2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 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 along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <sysdep-cancel.h>
 
-/* Test for access to FILE.  */
 int
 __access (const char *file, int type)
 {
-  return INLINE_SYSCALL (faccessat, 3, AT_FDCWD, file, 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)
This page took 0.16148 seconds and 5 git commands to generate.