changeset 1943:40a2a5a54fce

Fix use of fstatat in NIO2 on architectures other than x86 and x86_64. 2010-07-21 Andrew John Hughes <ahughes@redhat.com> * NEWS: Add NIO2 changes. 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 17:31:46 +0100
parents 4b9a6c6f0b30
children 87c67dea5e0a fd1a03a89469
files ChangeLog NEWS overlays/nio2/openjdk/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
diffstat 3 files changed, 20 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jul 21 17:27:47 2010 +0100
+++ b/ChangeLog	Wed Jul 21 17:31:46 2010 +0100
@@ -1,3 +1,12 @@
+2010-07-21  Andrew John Hughes  <ahughes@redhat.com>
+
+	* NEWS: Add NIO2 changes.
+
+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-21  Andrew John Hughes  <ahughes@redhat.com>
 
 	* NEWS: Updated for 1.7.4.
--- a/NEWS	Wed Jul 21 17:27:47 2010 +0100
+++ b/NEWS	Wed Jul 21 17:31:46 2010 +0100
@@ -44,6 +44,8 @@
 * SystemTap support:
   - PR476: Enable building SystemTap support on GCC 4.5.
   - Fix HotSpot tapset object_alloc size variable.
+* NIO2 support:
+  - Fix UnixNativeDispatcher to build on all systems, not just x86 and x86_64.
 
 New in release 1.7.3 (2010-03-31):
 
--- a/overlays/nio2/openjdk/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Wed Jul 21 17:27:47 2010 +0100
+++ b/overlays/nio2/openjdk/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Wed Jul 21 17:31:46 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
 }