RandomAccessFile and 1.4
Greg Lewis
glewis at eyesbeyond.com
Wed Jul 21 07:43:48 PDT 2004
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 at eyesbeyond.com
Eyes Beyond Web : http://www.eyesbeyond.com
Information Technology FreeBSD : glewis at FreeBSD.org
-------------- next part --------------
--- ../../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
More information about the freebsd-java
mailing list