From owner-freebsd-hackers Tue Jul 29 20:45:08 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id UAA04333 for hackers-outgoing; Tue, 29 Jul 1997 20:45:08 -0700 (PDT) Received: from kithrup.com (kithrup.com [205.179.156.40]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id UAA04328 for ; Tue, 29 Jul 1997 20:45:03 -0700 (PDT) Received: (from sef@localhost) by kithrup.com (8.6.8/8.6.6) id UAA16264; Tue, 29 Jul 1997 20:44:55 -0700 Date: Tue, 29 Jul 1997 20:44:55 -0700 From: Sean Eric Fagan Message-Id: <199707300344.UAA16264@kithrup.com> To: hackers@freebsd.org Subject: Re: Location of copyin() and copyout().. In-Reply-To: <199707300310.UAA12221.kithrup.freebsd.hackers@implode.root.com> References: Your message of "Wed, 30 Jul 1997 12:19:48 +0930." <199707300249.MAA17292@genesis.atrad.adelaide.edu.au> Organization: Kithrup Enterprises, Ltd. Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk In article <199707300310.UAA12221.kithrup.freebsd.hackers@implode.root.com> you write: >If on the other hand you're copying from kernel<->kernel, then you can just >use bcopy. I'm afraid that I started reading this thread rather late into it >and don't have the original context...so what are we talking about? :-) Many kernel functions already use copyin/copyout. Consider fstat(). The last thing it does (before a return) is: error = copyout((caddr_t)&ub, (caddr_t)uap->sb, sizeof (ub)); Now consider ibcs2_fstat(). Rather than duplicate the work of fstat (which would really be a bad thing, because fstat may change and ibcs2_fstat may not be updated), ibcs2_fstat goes through some *HORRIBLE* hacks to allocate some space in user space, using the stackgap_alloc() function. If fstat used uiomove(), then it could go to a kernel address. (Admittedly, it would still have to be changed -- it would have to have a struct uio passed in, probably. But then ibcs2_fstat could call that common function, with less pain.) Mind you, I'm probably not going to stop using copyin()/copyout() myself... but it is something to consider. And it's a valid point. (Unless, of course, you don't think that the emulation support is worthwhile :).) Please let me know if this still isn't clear... I've been working on some other stuff, and am tired, and my explanation ability goes downhill quickly when I'm tired :).