[git commit] libc: TIME64_COMPAT32 for sparc, mips

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Mon Mar 23 23:11:15 UTC 2015


commit: http://git.uclibc.org/uClibc/commit/?id=eee76e42f32f90af4e64a254810fcb767297fecf
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 libc/sysdeps/linux/common/bits/utmp.h      |    4 ++--
 libc/sysdeps/linux/common/bits/utmpx.h     |    2 +-
 libc/sysdeps/linux/mips/bits/wordsize.h    |    3 +++
 libc/sysdeps/linux/powerpc/bits/wordsize.h |    2 +-
 libc/sysdeps/linux/sparc/bits/wordsize.h   |    1 +
 libc/sysdeps/linux/x86_64/bits/wordsize.h  |    9 ++++++---
 libutil/logout.c                           |    2 +-
 libutil/logwtmp.c                          |    2 +-
 8 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/libc/sysdeps/linux/common/bits/utmp.h b/libc/sysdeps/linux/common/bits/utmp.h
index c13380a..6ece31e 100644
--- a/libc/sysdeps/linux/common/bits/utmp.h
+++ b/libc/sysdeps/linux/common/bits/utmp.h
@@ -36,7 +36,7 @@
    previous logins.  */
 struct lastlog
   {
-#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+#ifdef __WORDSIZE_TIME64_COMPAT32
     int32_t ll_time;
 #else
     __time_t ll_time;
@@ -69,7 +69,7 @@ struct utmp
 /* The ut_session and ut_tv fields must be the same size when compiled
    32- and 64-bit.  This allows data files and shared memory to be
    shared between 32- and 64-bit applications.  */
-#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+#ifdef __WORDSIZE_TIME64_COMPAT32
   int32_t ut_session;		/* Session ID, used for windowing.  */
   struct
   {
diff --git a/libc/sysdeps/linux/common/bits/utmpx.h b/libc/sysdeps/linux/common/bits/utmpx.h
index 87626f0..815fc90 100644
--- a/libc/sysdeps/linux/common/bits/utmpx.h
+++ b/libc/sysdeps/linux/common/bits/utmpx.h
@@ -66,7 +66,7 @@ struct utmpx
 /* The fields ut_session and ut_tv must be the same size when compiled
    32- and 64-bit.  This allows files and shared memory to be shared
    between 32- and 64-bit applications.  */
-#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+#ifdef __WORDSIZE_TIME64_COMPAT32
   __int32_t ut_session;		/* Session ID, used for windowing.  */
   struct
   {
diff --git a/libc/sysdeps/linux/mips/bits/wordsize.h b/libc/sysdeps/linux/mips/bits/wordsize.h
index 39e1506..fe13080 100644
--- a/libc/sysdeps/linux/mips/bits/wordsize.h
+++ b/libc/sysdeps/linux/mips/bits/wordsize.h
@@ -16,3 +16,6 @@
    <http://www.gnu.org/licenses/>.  */
 
 #define __WORDSIZE	_MIPS_SZPTR
+#if _MIPS_SIM == _ABI64
+# define __WORDSIZE_TIME64_COMPAT32 1
+#endif
diff --git a/libc/sysdeps/linux/powerpc/bits/wordsize.h b/libc/sysdeps/linux/powerpc/bits/wordsize.h
index cf93423..3e8a1e0 100644
--- a/libc/sysdeps/linux/powerpc/bits/wordsize.h
+++ b/libc/sysdeps/linux/powerpc/bits/wordsize.h
@@ -2,7 +2,7 @@
 
 #if defined __powerpc64__
 # define __WORDSIZE	64
-# define __WORDSIZE_COMPAT32	1
+# define __WORDSIZE_TIME64_COMPAT32	1
 #else
 # define __WORDSIZE	32
 #endif
diff --git a/libc/sysdeps/linux/sparc/bits/wordsize.h b/libc/sysdeps/linux/sparc/bits/wordsize.h
index c0e600e..aa15dbc 100644
--- a/libc/sysdeps/linux/sparc/bits/wordsize.h
+++ b/libc/sysdeps/linux/sparc/bits/wordsize.h
@@ -2,6 +2,7 @@
 
 #if defined __arch64__ || defined __sparcv9
 # define __WORDSIZE	64
+# define __WORDSIZE_TIME64_COMPAT32 1
 #else
 # define __WORDSIZE	32
 #endif
diff --git a/libc/sysdeps/linux/x86_64/bits/wordsize.h b/libc/sysdeps/linux/x86_64/bits/wordsize.h
index e555241..9db982c 100644
--- a/libc/sysdeps/linux/x86_64/bits/wordsize.h
+++ b/libc/sysdeps/linux/x86_64/bits/wordsize.h
@@ -1,9 +1,12 @@
 /* Determine the wordsize from the preprocessor defines.  */
 
-#if defined __x86_64__
+#if defined __x86_64__ && !defined __ILP32__
 # define __WORDSIZE	64
-/* This makes /var/run/utmp compatible with 32-bit environment: */
-# define __WORDSIZE_COMPAT32	1
 #else
 # define __WORDSIZE	32
 #endif
+
+#ifdef __x86_64__
+/* This makes /var/run/utmp compatible with 32-bit environment: */
+# define __WORDSIZE_TIME64_COMPAT32	1
+#endif
diff --git a/libutil/logout.c b/libutil/logout.c
index 9c7440b..4580455 100644
--- a/libutil/logout.c
+++ b/libutil/logout.c
@@ -50,7 +50,7 @@ logout (const char *line)
       memset (ut->ut_host, 0, sizeof ut->ut_host);
 #endif
 #if _HAVE_UT_TV - 0
-# if !defined __WORDSIZE_COMPAT32 || __WORDSIZE_COMPAT32 == 0
+# if !defined __WORDSIZE_TIME64_COMPAT32
       gettimeofday (&ut->ut_tv, NULL);
 # else
       {
diff --git a/libutil/logwtmp.c b/libutil/logwtmp.c
index 2a6f28a..6a53b5f 100644
--- a/libutil/logwtmp.c
+++ b/libutil/logwtmp.c
@@ -23,7 +23,7 @@ void logwtmp(const char *line, const char *name, const char *host)
     strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1);
     strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1);
     strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1);
-#if !defined __WORDSIZE_COMPAT32 || __WORDSIZE_COMPAT32 == 0
+#if !defined __WORDSIZE_TIME64_COMPAT32
     gettimeofday(&lutmp.ut_tv, NULL);
 #else
     {


More information about the uClibc-cvs mailing list