changeset 2421:2017795af50a icedtea7-1.13

Make UnixNativeDispatcher build on archs other than x86 and x86_64.
author andrew
date Tue, 27 Jul 2010 17:54:56 +0100
parents a3030e4f2e18
children 869388fead27
files src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
diffstat 1 files changed, 10 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Tue Jun 29 14:42:30 2010 +0400
+++ b/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Tue Jul 27 17:54:56 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,34 +109,6 @@
 static fdopendir_func* my_fdopendir_func = NULL;
 
 /**
- * fstatat missing from glibc on Linux. Temporary workaround
- * for x86/x64.
- */
-#if defined(__linux__) && defined(__i386)
-#define FSTATAT64_SYSCALL_AVAILABLE
-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__)
-#define FSTATAT64_SYSCALL_AVAILABLE
-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
  */
@@ -200,10 +179,10 @@
     my_futimesat_func = (futimesat_func*) dlsym(RTLD_DEFAULT, "futimesat");
     my_fdopendir_func = (fdopendir_func*) dlsym(RTLD_DEFAULT, "fdopendir");
 
-#if defined(FSTATAT64_SYSCALL_AVAILABLE)
-    /* fstatat64 missing from glibc */
+#if defined(_ATFILE_SOURCE)
+    /* 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
 
     if (my_openat64_func != NULL &&  my_fstatat64_func != NULL &&