xenix III device driver help

csc at riccb.UUCP csc at riccb.UUCP
Sat Jan 24 15:05:27 AEST 1987


here you go line eater


please excuse my stupidity but this is the first device driver
that i have muddled my way through.  i am not sure how a device
driver returns a value to the calling function.  i'm working
with XENIX System III on an Intel 310.
this is my understanding on how the read command works
under system III.

read(dev);  <----    read(dev);    <--- bytes=read(fd,buf,cnt); 

return;     ---->  if(errno!=0)
		    return(-1);	 --->
		  else			if(bytes==-1||bytes!=cnt)	
		    return(0);   --->     something's wrong;	

the user or application program executes a read(fd,buf,cnt) to
a special file.  the kernel finds the major and minor numbers 
for the device and calls the "device driver read" routine
with the arguments passed through the "u" structure. the device
driver read function accesses the information and copies the data
it into the "u" structure (sets errno if an error occurs) and
returns to the kernel.  the kernel then checks errno to see
if it is set.  if so it returns  (-1) to the user process else
it returns 0.  
what i need to know is how do I get the # of bytes transfered 
back to the user process??   Is everything returned through
the "u" structure?? (seems so).  Do i have to acces the u.u_count
in my user process?? any help would be appreciated. is this done
any differently that system V? thanks in advance.

                      
                                                      *** * ***
Craig S. Curtin                                     ***** * *****
Rockwell International (WTPD)                      ****** * ******
(312) 985-9000 x2376                               *****  *  *****
....!ihnp4!riccb!csc                                **  *****  **
                                                       *******



More information about the Comp.unix.wizards mailing list