Hi > I was looking at your Linux code here and thought > the technique of trying lseek(SEEK_END) might work.
Linux 2.6.18, /dev/hda and /dev/sr0, with a CD-RW written by write type TAO lseek(fd, 0, SEEK_END)= 636499968 lseek(fd, -1, SEEK_END)= 636499967 lseek(fd, -300k, SEEK_END)= 636192768 and with a CD-ROM media: lseek(fd, 0, SEEK_END)= 618311680 lseek(fd, -1, SEEK_END)= 618311679 lseek(fd, -300k, SEEK_END)= 618004480 (No tape drive at hand. Sorry.) Nevertheless: SEEK_END brings you to the first unwritten address of the file object. With a read-only object, this address is not necessarily defined. Further: If you test a CD that was written by write type TAO, then the last two blocks of the track are no readable data blocks. It depends on the implementation of lseek() whether it will allow you to address bytes in those two blocks. (Read will fail, of course. On Linux it even fails shortly before the end because of the old TAO read-ahead bug.) So on CD i would test rather lseek() to an address that is several hundred kB before the end. 300 kB is the traditional fear-padding of CD burn programs on Linux. (On Linux i decide by stat(2). Considered as seekable are S_IFREG and S_IFBLK. Actually tested only with optical drives and USB sticks. To my knowledge ioctl(BLKGETSIZE) works only on S_IFBLK.) Have a nice day :) Thomas _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"