Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Dec 2000 08:55:50 +1030
From:      Matthew Thyer <Matthew.Thyer@dsto.defence.gov.au>
To:        current@freebsd.org
Subject:   Re: Re: write(2) returns error saying read only filesystem when  trying to write to a partition
Message-ID:  <3A35546E.E4359366@dsto.defence.gov.au>
References:  <200012080154.eB81sFN00538@mass.osd.bsdi.com> <3A305227.D74011C4@dsto.defence.gov.au> <20001207221408.A29041@dragon.nuxi.com> <3A354E66.A18D5D0B@dsto.defence.gov.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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