[comp.unix.i386] Help Needed with Xenix Device Drivers

bruce@bmhalh.UUCP (Bruce M. Himebaugh) (08/19/90)

I am writing a character device driver under SCO Xenix (v2.3.3) and have run
across a stumbling block.  During the read and write functions I wish to
access the current file postition (as set by lseek(S)).  Per the documentation
that I have I access the element u_offset in the 'u' structure.  This works
great for 0-65535.  But, when I tell lseek(S) to move to postition 65536 the
value of u_offset gets set to 0 and if I move to 65537 it gets set to 1, etc.
I have the feeling that u_offset is just a an offset into the current segment
and when accessing values outside 65535 I am actually moving the file pointer
into another segment, but how do I tell what that segment is?  Hopefully I am
partially on the right track, but if I'm not I would appreciate some direction.
I have programmed in C for quite a while, but am just now tackling device
drivers.

A second question is, where can I get a book (or books) on writing XENIX device
drivers?  I have a book on UNIX device drivers, but Xenix is enough different
that it doesn't answer all my questions.

Any help on these two questions will be GREATLY appreciated.

Thanks,

Bruce
-- 
Bruce M. Himebaugh                                          Voice: 216-484-3528
   PATHS: uunet!{ncoast,aablue}!fmsystm!bmhalh!bruce
          (NOTE: the system name "fmsystm" is with no "e", NOT "fmsystem")
  *NOTE*: Please do not use bruce@bmhalh.UUCP -- I'm not registered yet.

cpcahil@virtech.uucp (Conor P. Cahill) (08/29/90)

First off, don't do this:

>Followup-To: poster

It gets people mad when they do a follow-up to somebody named poster on the
local machine.  If you want help, just leave the follow-up off.

In article <24@bmhalh.UUCP> bruce@bmhalh.UUCP (Bruce M. Himebaugh) writes:
>I am writing a character device driver under SCO Xenix (v2.3.3) and have run
>across a stumbling block.  During the read and write functions I wish to
>access the current file postition (as set by lseek(S)).  Per the documentation
>that I have I access the element u_offset in the 'u' structure.  This works
>great for 0-65535.  But, when I tell lseek(S) to move to postition 65536 the
>value of u_offset gets set to 0 and if I move to 65537 it gets set to 1, etc.

This sounds like you are using the u_offset as a short (or int) when it is 
really a long.  The type of u_offset is usually a typedef (off_t) in 
/usr/include/sys/types.h.
>
>A second question is, where can I get a book (or books) on writing XENIX device
>drivers?  I have a book on UNIX device drivers, but Xenix is enough different
>that it doesn't answer all my questions.

Writing a Unix Device Driver
by Janet Egan and Thomas Teixeira
Published by John Wiley & sons.

-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170