How to distinguish between STREAMS and non-STREAMS

josef Moellers josef at nixpbe.nixdorf.de
Thu Jan 17 19:13:37 AEST 1991


In <dcm.663952404 at baldur> dcm at baldur.dell.com (Dave McCracken) writes:

>josef at nixpbe.nixdorf.de (josef Moellers) writes:

>>Does anybody now of a bulletproof and FAST method to distinguish between
>>a STREAMS fd and a non-STREAMS fd?
>>I cannot use calls to getmsg/putmsg, as I am not allowed to change the
>>state of the STREAM.

>I would say right offhand you should do a streams-specific query ioctl.
>A few that might be useful are I_LOOK, I_GRDOPT, I_GRWOPT, and I_LIST.
>I_LIST might be particularly fast since if you pass it a NULL pointer
>for the list, it just returns the number of modules on the stream,
>and this information comes directly out of the stream head.

This was my first approach. We have access to the source code, so I used
I_GRDOPT, as this referenced a single field in the stream head, and so
was fastest.
But ... the f!@#$%^&*( SCO UNIX uses the numerical code for I_GRDOPT on
ttys to switch modes on the console windows, so when the application
calls the select()-function -whoops- goes Your screen!

--
| Josef Moellers		| c/o Siemens Nixdorf Informationssysteme AG |
|  USA: mollers.pad at nixdorf.com	| Abt. STO-XS 113			     |
| !USA: mollers.pad at nixdorf.de	| Heinz-Nixdorf-Ring			     |
| Phone: (+49) 5251 104662	| D-4790 Paderborn			     |



More information about the Comp.unix.internals mailing list