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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to