This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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(+)

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
-- 
2.7.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]