[comp.unix.ultrix] DEVIOCGET question

rmark@lll-lcc.UUCP (Richard Mark) (03/23/90)

I have a question about DEVIOCGET.

First the background: VAX 11/750, Ultrix 2.0-1

What routines or what actions cause an ioctl(DEVIOCGET) call?
What devices need to handle an ioctl(DEVIOCGET) call?

We have a specialized UNIBUS device (HSPI) which we are trying to get
connected and running on our system.  I added the device in the
config file, made the appropriate entries in files.vax, placed the
driver sources in /sys/vaxuba, added the appropriate stuff in the cdevsw 
table of the conf.c file and made the appropriate /dev/hspi0 node with the
correct access rights (crw-rw-rw).  I completed reconfiguring, rebuilding 
and rebooting the new system without problems.  I had problems opening 

I had problems opening the device for reading and writing but no problems
when opening for just reading.  To debug my problem I put printfs 
in the driver code (in the hspiopen() and hspiioclt() routines)

When I open("/dev/hspi0",O_RDONLY) it called hspiopen() which calls
hspiioctl(cmd=START) returns from hspiioctl() successfully, then
returns from hspiopen() successfully and the open() returns successfully.

When I open("/dev/hspi0",O_RDWR) it called hspiopen() which calls
hspiioctl(cmd=START) returns from hspiioctl() successfully, then
returns from hspiopen() successfully THEN it calls hspiioctl(cmd=DEVIOCGET)
and the open() returns unsuccessfully.  Although hspiioctl() does not
handle that case, there is a default case which doesn't do anything
and still returns from hspiioctl() successfully.

To repeat my original questions:
What routines or what actions cause an ioctl(DEVIOCGET) call?
What devices need to handle an ioctl(DEVIOCGET) call?

And now some more questions:
Is this specific to a certain version of Ultrix?
Where can I find out what values I should put in the devget struct?
Where is any of this documented?

I have probably left out some details or not explained somethings
clearly enough but hopefully someone will have some clue about my
problem.  If you need more info, drop me a note.

Thanks,

Rich
rmark@lll-lcc.llnl.gov

grr@cbmvax.commodore.com (George Robbins) (03/26/90)

In article <2772@lll-lcc.UUCP> rmark@lll-lcc.UUCP (Richard Mark) writes:
> 
> What routines or what actions cause an ioctl(DEVIOCGET) call?
> What devices need to handle an ioctl(DEVIOCGET) call?

Did you get any answers yet?  If not, you can take adb and take a whack at
one of the simpler drivers.  I've seen the DEVIOCGET stuff in passing, but
didn't analyze it that closely.  Seem to involve stuffing data into a
structure, so there's probably a header file involved somewhere.

> And now some more questions:
> Is this specific to a certain version of Ultrix?

I think it showed up in 3.x, this about the time dump started being able
to figure out whether a tape drive was at 1600 or 6250bpi...

> Where can I find out what values I should put in the devget struct?

/usr/include/sys/devio.h

> Where is any of this documented?

ha...DEC seems to love making various changes to Ultrix that move it farther
from 4.2BSD compatibility and not documenting any of the details.  I guess if
you spring for a source license it's obvious, but you shouldn't need a source
license for drivers and syscalls...

-- 
George Robbins - now working for,     uucp:   {uunet|pyramid|rutgers}!cbmvax!grr
but no way officially representing:   domain: grr@cbmvax.commodore.com
Commodore, Engineering Department     phone:  215-431-9349 (only by moonlite)