[1/2] generic/wordsize-32: don't duplicate lxstat, xstat if XSTAT_IS_XSTAT64 is enabled
diff mbox

Message ID 1473436199-3305-2-git-send-email-ynorov@caviumnetworks.com
State New
Headers show

Commit Message

Yury Norov Sept. 9, 2016, 3:49 p.m. UTC
If XSTAT_IS_XSTAT64 is enabled, there's no difference between that
syscalls and their 64-bit versions. It also means that struct stat has
no pads, and stat_overflow() is not needed. So we can reuse lxstat64
and xstat64.

In this patch, syscalls are redirected to their 64-bit versions. At now,
the only user of it is aarch64/ilp32 that is under development, but the
patch may be applied separately because it's generic.

2016-09-09: Yury Norov  <ynorov@caviumnetworks.com>

	* sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat.c: don't
	  declare __lxstat() and symbols if XSTAT_IS_XSTAT64 is enabled.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat64.c: declare
	  __lxstat symbols if XSTAT_IS_XSTAT64 is enabled.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/xstat.c: don't
	  declare __xstat() and symbols if XSTAT_IS_XSTAT64 is enabled.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c: declare
	  __xstat symbols if XSTAT_IS_XSTAT64 is enabled.

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat.c   | 2 ++
 sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat64.c | 7 +++++++
 sysdeps/unix/sysv/linux/generic/wordsize-32/xstat.c    | 2 ++
 sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c  | 7 +++++++
 4 files changed, 18 insertions(+)

Patch
diff mbox

diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat.c
index 395f98b..4fec6c9 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat.c
@@ -25,6 +25,7 @@ 
 #include <sysdep.h>
 #include <sys/syscall.h>
 
+#ifndef XSTAT_IS_XSTAT64
 #include "overflow.h"
 
 /* Get information about the file NAME in BUF.  */
@@ -41,3 +42,4 @@  __lxstat (int vers, const char *name, struct stat *buf)
   return -1;
 }
 hidden_def (__lxstat)
+#endif
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat64.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat64.c
index e1c15a8..96cb710 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat64.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat64.c
@@ -15,6 +15,7 @@ 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
+#define __lxstat __lxstat_disable
 
 #include <errno.h>
 #include <stddef.h>
@@ -36,3 +37,9 @@  __lxstat64 (int vers, const char *name, struct stat64 *buf)
   return -1;
 }
 hidden_def (__lxstat64)
+
+#undef __lxstat
+#ifdef XSTAT_IS_XSTAT64
+strong_alias (__lxstat64, __lxstat)
+hidden_ver (__lxstat64, __lxstat)
+#endif
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat.c
index fdd2cb0..8fc13bd 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat.c
@@ -25,6 +25,7 @@ 
 #include <sysdep.h>
 #include <sys/syscall.h>
 
+#ifndef XSTAT_IS_XSTAT64
 #include "overflow.h"
 
 /* Get information about the file NAME in BUF.  */
@@ -41,3 +42,4 @@  __xstat (int vers, const char *name, struct stat *buf)
   return -1;
 }
 hidden_def (__xstat)
+#endif
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c
index 2252337..b3d281e 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c
@@ -15,6 +15,7 @@ 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
+#define __xstat __xstat_disable
 
 #include <errno.h>
 #include <stddef.h>
@@ -36,3 +37,9 @@  __xstat64 (int vers, const char *name, struct stat64 *buf)
   return -1;
 }
 hidden_def (__xstat64)
+
+#undef __xstat
+#ifdef XSTAT_IS_XSTAT64
+strong_alias (__xstat64, __xstat)
+hidden_ver (__xstat64, __xstat)
+#endif