Xref: utzoo comp.unix.wizards:6482 comp.unix.questions:5548 Path: utzoo!utgpu!water!watmath!clyde!burl!codas!mtune!whuts!picuxa!gp From: gp@picuxa.UUCP (Greg Pasquariello X1190) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: A Question Concerning Device Drivers Summary: use copyin(), copyout() Keywords: ? Message-ID: <480@picuxa.UUCP> Date: 12 Feb 88 14:44:38 GMT References: <2879@watale.waterloo.edu> Distribution: na Organization: AT&T Information Systems, Parsippany NJ Lines: 32 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.