[comp.unix.wizards] Character special files cannot seek?

levy@ttrdc.UUCP (Daniel R. Levy) (07/01/87)

In article <633@haddock.UUCP>, karl@haddock.UUCP (Karl Heuer) writes:
< "isatty" is not sufficient; character-special files in general are incapable
< of seeking.

It's my impression from experimentation on System V that at least some
raw disk drives can be lseek'ed [lsought? :-) ] upon.  Is this mistaken?
-- 
|------------dan levy------------|  Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
|         an engihacker @        |		vax135}!ttrdc!ttrda!levy
|    at&t data systems division  |  Disclaimer:  try datclaimer.
|--------skokie, illinois--------|

jfh@killer.UUCP (John Haugh) (07/03/87)

I seem to recall that you can seek on the following character special files
(or your local version thereof)
	/dev/mem
	/dev/kmem
	/dev/rdsk/*
I think the only things that leaves out are raw tapes and ttys.  Did anyone
not really know this?  Of course you can't seek on the WONDERFUL new
pseudo devices like /dev/error, /dev/prf, ad nauseum.  But then, REAL
programmers still use Version 6 or Version 7 ...

- John (Still thinking about a .signature in the Big D).

karl@haddock.ISC.COM (Karl Heuer) (07/11/87)

In article <1088@killer.UUCP> jfh@killer.UUCP (John Haugh) writes:
>I seem to recall that you can seek on [the c-special files mem, kmem, rdsk].
>I think the only things that leaves out are raw tapes and ttys.  Did anyone
>not really know this?

When I said "character special files are not seekable in general", I did not
mean to imply that all such were nonseekable, but that not all such were
seekable.  My article asserted that "isatty()" was not an appropriate test for
seekability.  The example of raw tape proves my statement.

I was assuming that the canseek() function, when presented with a c-special
file, should conservatively assume nonseekability.  In normal usage, this is
appropriate.

Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint