[comp.unix.xenix] no peek or poke under xenix?

phb@dcdwest.UUCP (Peter H. Berens) (02/24/88)

We have a device driver for a memory mapped device that crashes the
system when the board is not installed in the system and someone opens
the device node.  We would like to be able to use peek or poke in the
open routine to determine if the memory addresses the board responds
to are present, however xenix does not appear to support any such
functions as peek or poke to carry this out.  Does anyone know how
this should be handled under xenix?  All the example device drivers
do not appear to deal with this problem.

Thanks in advance.

terry@wsccs.UUCP (terry) (03/04/88)

In article <284@dcdwest.UUCP>, phb@dcdwest.UUCP (Peter H. Berens) writes:
> We have a device driver for a memory mapped device that crashes the
> system when the board is not installed in the system and someone opens
> the device node.  We would like to be able to use peek or poke in the
> open routine to determine if the memory addresses the board responds
> to are present

	Use a setuid(geteuid()) root program (chmod 4755) to open /dev/mem
and lseek() to your offset location.  Then just read.

			:-)

PS: This is a nifty way to put one of thos damn clocks in the upper-right
hand corner of your screen... just write to the upper right-hand corner.


| Terry Lambert           UUCP: ...!decvax!utah-cs!century!terry              |
| @ Century Software       or : ...utah-cs!uplherc!sp7040!obie!wsccs!terry    |
| SLC, Utah                                                                   |
|                   These opinions are not my companies, but if you find them |
|                   useful, send a $20.00 donation to Brisbane Australia...   |
| 'There are monkey boys in the facility.  Do not be alarmed; you are secure' |