changeset 1736:77b720a556d3

Fix use of fstatat in NIO2 on architectures other than x86 and x86_64. 2010-07-20 Andrew John Hughes <ahughes@redhat.com> * overlays/nio2/openjdk/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c: Define _ATFILE_SOURCE to obtain fstatat64, regardless of architecture.
author Andrew John Hughes <ahughes@redhat.com>
date Wed, 21 Jul 2010 09:22:50 +0100
parents f5cff4063cf3
children 5ff85a33bb11
files ChangeLog overlays/nio2/openjdk/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
diffstat 2 files changed, 15 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jul 16 16:56:44 2010 -0400
+++ b/ChangeLog	Wed Jul 21 09:22:50 2010 +0100
@@ -1,7 +1,12 @@
+2010-07-20  Andrew John Hughes  <ahughes@redhat.com>
+
+	* overlays/nio2/openjdk/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c:
+	Define _ATFILE_SOURCE to obtain fstatat64, regardless of architecture.
+
 2010-07-15  Deepak Bhole <dbhole@redhat.com>
 
 	* patches/openjdk/6678385.patch: Revert behaviour of isOverrideRedirect to
-	always return false, since XToolKit does not support isOverrideRedirect (as 
+	always return false, since XToolKit does not support isOverrideRedirect (as
 	upstream patch assumes).
 
 2010-07-16  Deepak Bhole <dbhole@redhat.com>
--- a/overlays/nio2/openjdk/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Fri Jul 16 16:56:44 2010 -0400
+++ b/overlays/nio2/openjdk/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Wed Jul 21 09:22:50 2010 +0100
@@ -23,6 +23,13 @@
  * have any questions.
  */
 
+/**
+ * fstatat in glibc requires _ATFILE_SOURCE to be defined.
+ */
+#if defined(__linux__)
+#define _ATFILE_SOURCE
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <limits.h>
@@ -102,32 +109,6 @@
 static fdopendir_func* my_fdopendir_func = NULL;
 
 /**
- * fstatat missing from glibc on Linux. Temporary workaround
- * for x86/x64, will fail to compile on other architectures.
- */
-#if defined(__linux__) && defined(__i386)
-static int fstatat64_wrapper(int dfd, const char *path,
-                             struct stat64 *statbuf, int flag)
-{
-    #ifndef __NR_fstatat64
-    #define __NR_fstatat64  300
-    #endif
-    return syscall(__NR_fstatat64, dfd, path, statbuf, flag);
-}
-#endif
-
-#if defined(__linux__) && defined(__x86_64__)
-static int fstatat64_wrapper(int dfd, const char *path,
-                             struct stat64 *statbuf, int flag)
-{
-    #ifndef __NR_newfstatat
-    #define __NR_newfstatat  262
-    #endif
-    return syscall(__NR_newfstatat, dfd, path, statbuf, flag);
-}
-#endif
-
-/**
  * Call this to throw an internal UnixException when a system/library
  * call fails
  */
@@ -198,9 +179,9 @@
     my_fdopendir_func = (fdopendir_func*) dlsym(RTLD_DEFAULT, "fdopendir");
 
 #if defined(__linux__)
-    /* fstatat64 missing from glibc */
+    /* fstatat64 from glibc requires a define */
     if (my_fstatat64_func == NULL)
-        my_fstatat64_func = (fstatat64_func*)&fstatat64_wrapper;
+        my_fstatat64_func = (fstatat64_func*)&fstatat64;
 #endif
 }