watmelon@watale.waterloo.edu (Mech. Eng. Robotics Group) (02/11/88)
In System V, is the cpass/passc combination the only way to pass data between a user's buffer and a character driver? It seems to be a bit of a waste of time to copy data one character at a time when you could probably do some kind of block copy. Are there other ways of passing the data?
lm@arizona.edu (Larry McVoy) (02/12/88)
In article <2879@watale.waterloo.edu> watmelon@watale.waterloo.edu (Mech. Eng. Robotics Group) writes: >In System V, is the cpass/passc combination the only way to pass data >between a user's buffer and a character driver? >It seems to be a bit of a waste of time to copy data one character at a time >when you could probably do some kind of block copy. >Are there other ways of passing the data? copyout(driverbuf,userbuf,n) caddr_t driverbuf, userbuf; unsigned n; copyin(userbuf,driverbuf,n) .... The kernel will not know if the user didn't have enough buffer space. -- Larry McVoy lm@arizona.edu or ...!{uwvax,sun}!arizona.edu!lm Use the force - read the source.
gp@picuxa.UUCP (Greg Pasquariello X1190) (02/12/88)
In article <2879@watale.waterloo.edu>, watmelon@watale.waterloo.edu (Mech. Eng. Robotics Group) writes: > In System V, is the cpass/passc combination the only way to pass data > between a user's buffer and a character driver? > It seems to be a bit of a waste of time to copy data one character at a time > when you could probably do some kind of block copy. > Are there other ways of passing the data? No. Yes. No, it is not the only way, Yes there are other ways. The kernel routines copyin() and copyout() copy a specified number of bytes from (to) the user space. They are called as follows: int copyin(from,to,n) char *from,to; unsigned n; copy a specified number of bytes from user space to kernel space. returns 0 if successful, otherwise -1. int copyout(from,to,n) char *from,to; unsigned n; copy a specified number of bytes from kernel space to user space. returns 0 if successful, otherwise -1. There are other routines that access user text space, or user data space, but the two shown above are the two used most often.
terryl@tekcrl.TEK.COM (02/16/88)
In article <3823@megaron.arizona.edu> lm@megaron.arizona.edu.UUCP (Larry McVoy) writes: >In article <2879@watale.waterloo.edu> watmelon@watale.waterloo.edu (Mech. Eng. Robotics Group) writes: >>In System V, is the cpass/passc combination the only way to pass data >>between a user's buffer and a character driver? >>It seems to be a bit of a waste of time to copy data one character at a time >>when you could probably do some kind of block copy. >>Are there other ways of passing the data? > >copyout(driverbuf,userbuf,n) >caddr_t driverbuf, userbuf; >unsigned n; > >copyin(userbuf,driverbuf,n) >.... > >The kernel will not know if the user didn't have enough buffer space. Tis true, but under BSD UNIX, there's a routine called useracc(useraddr, len, rw) that one can call to validate the address space the user wants to transfer into/out of(depending on the value of rw). Perhaps Sys V has something similar???? Boy Do I Hate Inews !!!! !!!!