From owner-freebsd-current Mon Dec 11 14:34: 6 2000 From owner-freebsd-current@FreeBSD.ORG Mon Dec 11 14:34:03 2000 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from digger1.defence.gov.au (digger1.defence.gov.au [203.5.217.4]) by hub.freebsd.org (Postfix) with ESMTP id BC0F737B400 for ; Mon, 11 Dec 2000 14:33:57 -0800 (PST) Received: from dsto-ms2.dsto.defence.gov.au (dsto-ms2.dsto.defence.gov.au [131.185.2.150]) by digger1.defence.gov.au (8.10.1/8.10.1) with ESMTP id eBBMYHQ07494 for ; Tue, 12 Dec 2000 09:04:18 +1030 (CST) Received: from muttley.dsto.defence.gov.au (unverified) by dsto-ms2.dsto.defence.gov.au (Content Technologies SMTPRS 4.1.5) with ESMTP id for ; Tue, 12 Dec 2000 09:03:17 +1030 Received: from salex001.dsto.defence.gov.au (salex001.dsto.defence.gov.au [131.185.2.9]) by muttley.dsto.defence.gov.au (8.9.3/8.9.3/8.9.3.LMD.990513) with ESMTP id IAA00770 for ; Tue, 12 Dec 2000 08:55:10 +1030 (CST) Received: from fang.dsto.defence.gov.au ([131.185.2.5]) by salex001.dsto.defence.gov.au with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id WZWR9QLB; Tue, 12 Dec 2000 08:55:09 +1030 Received: from dsto.defence.gov.au (fuzz.dsto.defence.gov.au [131.185.75.229]) by fang.dsto.defence.gov.au (8.9.3/8.9.3/8.9.3.LMD.990513) with ESMTP id IAA28391 for ; Tue, 12 Dec 2000 08:55:09 +1030 (CST) Sender: thyerm@dsto.defence.gov.au Message-ID: <3A35546E.E4359366@dsto.defence.gov.au> Date: Tue, 12 Dec 2000 08:55:50 +1030 From: Matthew Thyer X-Mailer: Mozilla 4.76 [en] (X11; U; FreeBSD 5.0-CURRENT i386) X-Accept-Language: en MIME-Version: 1.0 To: current@freebsd.org Subject: Re: Re: write(2) returns error saying read only filesystem when trying to write to a partition References: <200012080154.eB81sFN00538@mass.osd.bsdi.com> <3A305227.D74011C4@dsto.defence.gov.au> <20001207221408.A29041@dragon.nuxi.com> <3A354E66.A18D5D0B@dsto.defence.gov.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I've been writing to the whole disk OK (since I changed to /dev/da18), but now I am finding a problem with trying to seek further into the disk before starting to write. The code fragment is below and the "lseek(fd, 0L, SEEK_SET)" works OK but the first "lseek(fd, 8192L, SEEK_CUR)" thereafter fails with an "Undefined error: 0" The only way I can get "lseek(fd, X, SEEK_CUR)" to work is where X = 0. Any ideas ? if ( (fd = open("/dev/da18",O_WRONLY)) < 0 ) { perror("open"); exit(1); } /* write alternating 1s and zeros to disk */ for (i = 1; i <= 5; i++) { /* rewind to start file partition */ if (lseek(fd, 0L, SEEK_SET) != 0) { perror("lseek seek_set"); exit(1); } count = 0L; /* Now seek up to where we are up to: */ do { if (lseek(fd, 8192L, SEEK_CUR) != 0) { perror("lseek seek_cur"); exit(1); } else ++count; } while ( count < 1062000 ); -- Matthew Thyer Phone: +61 8 8259 7249 Science Corporate Information Systems Fax: +61 8 8259 5537 Defence Science and Technology Organisation, Salisbury PO Box 1500 Salisbury South Australia 5108 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message