changeset 3683:4a5206f2e710

. Make these compile on BSD, typically by using the preprocessor to define foo64 as foo.
author Greg Lewis <glewis@eyesbeyond.com>
date Thu, 03 Mar 2011 18:42:24 -0800
parents 6d8011b743b1
children 52c2dff7c946
files src/share/native/java/util/zip/zip_util.c src/solaris/native/sun/management/FileSystemImpl.c src/solaris/native/sun/nio/ch/FileChannelImpl.c src/solaris/native/sun/nio/ch/FileDispatcherImpl.c src/solaris/native/sun/nio/ch/FileKey.c src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
diffstat 6 files changed, 43 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/java/util/zip/zip_util.c	Thu Mar 03 18:41:27 2011 -0800
+++ b/src/share/native/java/util/zip/zip_util.c	Thu Mar 03 18:42:24 2011 -0800
@@ -46,6 +46,11 @@
 #include "zip_util.h"
 #include "zlib.h"
 
+#ifdef _ALLBSD_SOURCE
+#define off64_t	off_t
+#define mmap64 mmap
+#endif
+
 /* USE_MMAP means mmap the CEN & ENDHDR part of the zip file. */
 #ifdef USE_MMAP
 #include <sys/mman.h>
--- a/src/solaris/native/sun/management/FileSystemImpl.c	Thu Mar 03 18:41:27 2011 -0800
+++ b/src/solaris/native/sun/management/FileSystemImpl.c	Thu Mar 03 18:42:24 2011 -0800
@@ -30,6 +30,10 @@
 #include "jni_util.h"
 #include "sun_management_FileSystemImpl.h"
 
+#ifdef _ALLBSD_SOURCE
+#define stat64 stat
+#endif
+
 /*
  * Class:     sun_management_FileSystemImpl
  * Method:    isAccessUserOnly0
--- a/src/solaris/native/sun/nio/ch/FileChannelImpl.c	Thu Mar 03 18:41:27 2011 -0800
+++ b/src/solaris/native/sun/nio/ch/FileChannelImpl.c	Thu Mar 03 18:42:24 2011 -0800
@@ -43,6 +43,9 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/uio.h>
+
+#define lseek64 lseek
+#define mmap64 mmap
 #endif
 
 static jfieldID chan_fd;        /* jobject 'fd' in sun.io.FileChannelImpl */
--- a/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c	Thu Mar 03 18:41:27 2011 -0800
+++ b/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c	Thu Mar 03 18:42:24 2011 -0800
@@ -37,6 +37,21 @@
 #include "nio.h"
 #include "nio_util.h"
 
+#ifdef _ALLBSD_SOURCE
+#define stat64 stat
+#define flock64 flock
+#define off64_t off_t
+#define F_SETLKW64 F_SETLKW
+#define F_SETLK64 F_SETLK
+
+#define pread64 pread
+#define pwrite64 pwrite
+#define ftruncate64 ftruncate
+#define fstat64 fstat
+
+#define fdatasync fsync
+#endif
+
 static int preCloseFD = -1;     /* File descriptor to which we dup other fd's
                                    before closing them for real */
 
--- a/src/solaris/native/sun/nio/ch/FileKey.c	Thu Mar 03 18:41:27 2011 -0800
+++ b/src/solaris/native/sun/nio/ch/FileKey.c	Thu Mar 03 18:42:24 2011 -0800
@@ -30,6 +30,12 @@
 #include "nio_util.h"
 #include "sun_nio_ch_FileKey.h"
 
+#ifdef _ALLBSD_SOURCE
+#define stat64 stat
+
+#define fstat64 fstat
+#endif
+
 static jfieldID key_st_dev;    /* id for FileKey.st_dev */
 static jfieldID key_st_ino;    /* id for FileKey.st_ino */
 
--- a/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Thu Mar 03 18:41:27 2011 -0800
+++ b/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Thu Mar 03 18:42:24 2011 -0800
@@ -51,6 +51,15 @@
 
 #ifdef _ALLBSD_SOURCE
 #include <string.h>
+
+#define stat64 stat
+#define statvfs64 statvfs
+
+#define open64 open
+#define fstat64 fstat
+#define lstat64 lstat
+#define dirent64 dirent
+#define readdir64_r readdir_r
 #endif
 
 #include "jni.h"
@@ -202,7 +211,7 @@
 
     /* system calls that might not be available at run time */
 
-#if defined(__solaris__) && defined(_LP64)
+#if (defined(__solaris__) && defined(_LP64)) || defined(_ALLBSD_SOURCE)
     /* Solaris 64-bit does not have openat64/fstatat64 */
     my_openat64_func = (openat64_func*)dlsym(RTLD_DEFAULT, "openat");
     my_fstatat64_func = (fstatat64_func*)dlsym(RTLD_DEFAULT, "fstatat");