easy way to determine if a stream or fd is seekable
Alexander Best
arundel at freebsd.org
Thu Nov 17 21:48:05 UTC 2011
On Thu Nov 17 11, Dieter BSD wrote:
> > lseek() on a tape drive does not return an error, nor does it
> > actually do anything.
>
> IIRC some tape drives can seek, while others cannot.
> Vague memories that it is supposed to be possible to put a
> filesystem on a DECtape and mount the filesystem.
or how about the following:
1) if the file argument we're seeking on is a tape drive, just do a regular
seek operation.
2) afterwards use ftell() to verify that the seek REALLY happend. if it didn't,
return -1 and set errno = EBADF.
cheers.
alex
>
> It might be that FreeBSD doesn't currently support seeking
> on a tape, but we shouldn't paint ourselves into a corner
> by assuming that it is fundimentally impossible.
More information about the freebsd-hackers
mailing list