Quote:
Originally posted by S.P.Prasad
Following is the cdevsw structure that we are using for developing stream device drivers in Sun and Sco unix Servers.
Well, I went looking for Sun's cdevsw. It took me several minutes to figure out why I can't find it. They don't have one. Sun uses a structure called cb_ops instead. (Are you getting your driver to compile on a Sun?? Which version of the OS?) But anyway, they do have full prototypes. The read entry is:
int (*cb_read)(dev_t dev, struct uio *uiop, Cred_t *credp)
However, the cb_ops table does indeed contain a pointer to a streamtab strucrure! I just called a friend of mine who has access to an SCO box. He mailed me his conf.h file and sure enough there is a pointer to a streamtab structure there. Like you, I don't understand what that pointer is for.
Looking at Sun's website, I found
this SunOS streams-based pty driver and I can't believe what I see. They are setting cb_read and cb_write to nodev!! I can only guess that the read() system call will notice the "nodev" and the presence of the streamtab pointer and then do what is needed to invoke the read queue directly.
I don't understand this implementation but apparently, if you establish the proper streamtab and qinit structures it's gonna work on a Sun. And maybe that's how SCO works as well.
As originally posted by Perderabo
"No there no exception for streams-based character drivers. "
I guess I'll have to eat those words. It would seem to depend on the specific OS.