how to tell if a descriptor is a streams device ??

Guy Harris guy at auspex.UUCP
Mon Feb 6 07:28:30 AEST 1989


 >Is there a "best" way to tell if a given descriptor refers to
 >a streams device ??  I've found that none of the simple ioctl's
 >listed in streamio(7) return the "Not a streams device" (errno=60)
 >error, which is the error message I'd like to get.

Well, you'll just have to get use to not getting it, because, in
general, UNIX systems tend to return ENOTTY or EINVAL if you do an
"ioctl" on a file descriptor that refers to an object that doesn't
recognize the "ioctl" in question.  Modifying *every* driver on the
system to return ENOSTR for all streams "ioctl"s (which is what would
have to have been done in order to get the result you want) would have
been time-consuming; furthermore, there's no guarantee that *every*
driver would have been caught.

I'd suggest using I_LOOK or I_FIND, since they don't modify the stream,
just look at it; if it returns an error, it's not a stream, otherwise,
it is. 



More information about the Comp.sys.att mailing list