build failure on latest sources?

Greg Lewis glewis at eyesbeyond.com
Wed Jul 22 12:25:41 PDT 2009


G'day John,

On Tue, Jul 21, 2009 at 10:18:52PM -0700, John Rose wrote:
> On Jul 21, 2009, at 3:14 AM, John Rose wrote:
> 
> > I just pulled changes for the first time since 5/20/2009 and ran  
> > into the problem described here:
> >  http://mail.openjdk.java.net/pipermail/bsd-port-dev/2009-May/000645.html
> >
> > What is the current workaround for Mac?
> 
> FTR, here's what got me out of the weeds.  -- John
> 
> diff --git a/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c b/ 
> src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
> --- a/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
> +++ b/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
> @@ -132,6 +132,18 @@
>   }
>   #endif
> 
> +#if defined(_ALLBSD_SOURCE) && !defined(__linux__)
> +/* Solaris function missing on Darwin.  Temporary workaround to allow  
> building.
> + * Ref http://mail.openjdk.java.net/pipermail/bsd-port-dev/2009-May/000645.html
> + */
> +static DIR* fake_fdopendir(int dfd) {
> +  errno = ENOSYS;
> +  return NULL;
> +}
> +#define fdopendir fake_fdopendir
> +#endif
> +
> +
>   /**
>    * Call this to throw an internal UnixException when a system/library
>    * call fails

Here is a patch I worked up for it.  Can you let me know if this works
for you also?  If so I'll get it committed.

diff -r cd10412684b5 src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
--- a/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Sun Jul 19 20:27:02 2009 -0700
+++ b/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Wed Jul 22 12:08:25 2009 -0700
@@ -97,12 +97,14 @@
 typedef int unlinkat_func(int, const char*, int);
 typedef int renameat_func(int, const char*, int, const char*);
 typedef int futimesat_func(int, const char *, const struct timeval *);
+typedef DIR* fdopendir_func(int);
 
 static openat64_func* my_openat64_func = NULL;
 static fstatat64_func* my_fstatat64_func = NULL;
 static unlinkat_func* my_unlinkat_func = NULL;
 static renameat_func* my_renameat_func = NULL;
 static futimesat_func* my_futimesat_func = NULL;
+static fdopendir_func* my_fdopendir_func = NULL;
 
 /**
  * fstatat missing from glibc on Linux. Temporary workaround
@@ -215,6 +217,8 @@
         flags |= sun_nio_fs_UnixNativeDispatcher_HAS_AT_SYSCALLS;
     }
 
+    my_fdopendir_func = (fdopendir_func*) dlsym(RTLD_DEFAULT, "fdopendir");
+
     return flags;
 }
 
@@ -570,8 +574,13 @@
 Java_sun_nio_fs_UnixNativeDispatcher_fdopendir(JNIEnv* env, jclass this, int dfd) {
     DIR* dir;
 
+    if (my_fdopendir_func == NULL) {
+        JNU_ThrowInternalError(env, "should not reach here");
+        return -1;
+    }
+
     /* EINTR not listed as a possible error */
-    dir = fdopendir((int)dfd);
+    dir = (*my_fdopendir_func)((int)dfd);
     if (dir == NULL) {
         throwUnixException(env, errno);
     }

-- 
Greg Lewis                          Email   : glewis at eyesbeyond.com
Eyes Beyond                         Web     : http://www.eyesbeyond.com
Information Technology              FreeBSD : glewis at FreeBSD.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fdopendir.diff
Type: text/x-diff
Size: 1508 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/bsd-port-dev/attachments/20090722/ed79b14d/fdopendir.diff 


More information about the bsd-port-dev mailing list