Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jul 2004 08:43:44 -0600
From:      Greg Lewis <glewis@eyesbeyond.com>
To:        Manfred Riem <mriem@manorrock.org>
Cc:        freebsd-java@freebsd.org
Subject:   Re: RandomAccessFile and 1.4
Message-ID:  <20040721144344.GA23048@misty.eyesbeyond.com>
In-Reply-To: <200407211119.i6LBJIMf019356@new.iagu.net>
References:  <200407211119.i6LBJIMf019356@new.iagu.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--17pEHd4RhPHOinZp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Jul 21, 2004 at 01:19:05PM +0200, Manfred Riem wrote:
> I've been trying to use the following code snippet using a RandomAccessFile.
> 
>   RandomAccessFile rfile = new RandomAccessFile( file, "rws" );
>   rfile.write( byte );
> 
> The current version of the J2SDK 1.4 throws a FileNotFoundException, while
> the
> Windows accepts it without any problems. 
> 
> Anyone a suggestion, besides dropping the 's' flag? I want to be sure 
> the changes have been written to the underlying storage before continuing.

D'oh.  This is a bug in the port.  I'm trying the attached patch but it
will take a couple hours to compile, etc.  The problem was that FreeBSD
doesn't define O_SYNC and O_DSYNC (neither on 4.x and only O_SYNC on 5.x)
so the code was defining O_SYNC as 0x800, which happens to be O_EXCL on
FreeBSD...

-- 
Greg Lewis                          Email   : glewis@eyesbeyond.com
Eyes Beyond                         Web     : http://www.eyesbeyond.com
Information Technology              FreeBSD : glewis@FreeBSD.org

--17pEHd4RhPHOinZp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="patch-io_util.h"

--- ../../j2se/src/share/native/java/io/io_util.h.orig	Wed Jul 21 08:32:49 2004
+++ ../../j2se/src/share/native/java/io/io_util.h	Wed Jul 21 08:37:54 2004
@@ -10,7 +10,15 @@
 
 extern jfieldID IO_fd_fdID;
 
-#if !defined(O_DSYNC) || !defined(O_SYNC)
+#ifdef _BSD_SOURCE
+#include <fcntl.h>
+#ifndef O_SYNC
+#define O_SYNC	O_FSYNC
+#endif
+#ifndef O_DSYNC
+#define O_DSYNC	O_FSYNC
+#endif
+#elif !defined(O_DSYNC) || !defined(O_SYNC)
 #define O_SYNC  (0x0800)
 #define O_DSYNC (0x2000)
 #endif

--17pEHd4RhPHOinZp--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040721144344.GA23048>