From owner-freebsd-java@FreeBSD.ORG Wed Jul 21 14:43:48 2004 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6BC3A16A4D4 for ; Wed, 21 Jul 2004 14:43:48 +0000 (GMT) Received: from mgr2.xmission.com (mgr2.xmission.com [198.60.22.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5315A43D55 for ; Wed, 21 Jul 2004 14:43:48 +0000 (GMT) (envelope-from glewis@eyesbeyond.com) Received: from [198.60.22.209] (helo=mgr9.xmission.com) by mgr2.xmission.com with esmtp (Exim 3.35 #1) id 1BnIJv-0000tZ-02; Wed, 21 Jul 2004 08:43:47 -0600 Received: from [166.70.56.15] (helo=misty.eyesbeyond.com) by mgr9.xmission.com with esmtp (Exim 4.32) id 1BnIJv-0000Fo-RA; Wed, 21 Jul 2004 08:43:47 -0600 Received: from misty.eyesbeyond.com (localhost.eyesbeyond.com [127.0.0.1]) i6LEhkPU023063; Wed, 21 Jul 2004 08:43:46 -0600 (MDT) (envelope-from glewis@eyesbeyond.com) Received: (from glewis@localhost) by misty.eyesbeyond.com (8.12.11/8.12.11/Submit) id i6LEhjQM023062; Wed, 21 Jul 2004 08:43:45 -0600 (MDT) (envelope-from glewis@eyesbeyond.com) X-Authentication-Warning: misty.eyesbeyond.com: glewis set sender to glewis@eyesbeyond.com using -f Date: Wed, 21 Jul 2004 08:43:44 -0600 From: Greg Lewis To: Manfred Riem Message-ID: <20040721144344.GA23048@misty.eyesbeyond.com> References: <200407211119.i6LBJIMf019356@new.iagu.net> Mime-Version: 1.0 Content-Disposition: inline In-Reply-To: <200407211119.i6LBJIMf019356@new.iagu.net> User-Agent: Mutt/1.4.2.1i Content-Type: multipart/mixed; boundary="17pEHd4RhPHOinZp" X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on mgr9.xmission.com X-Spam-Level: X-Spam-Status: No, hits=-4.9 required=8.0 tests=BAYES_00 autolearn=no version=2.63 X-SA-Exim-Connect-IP: 166.70.56.15 X-SA-Exim-Mail-From: glewis@eyesbeyond.com X-SA-Exim-Version: 4.0 (built Sat, 24 Apr 2004 12:31:30 +0200) X-SA-Exim-Scanned: Yes (on mgr9.xmission.com) cc: freebsd-java@freebsd.org Subject: Re: RandomAccessFile and 1.4 X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jul 2004 14:43:48 -0000 --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 +#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--