From owner-freebsd-hackers Fri Jul 13 16:32:44 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp6ve.mailsrvcs.net (smtp6vepub.gte.net [206.46.170.27]) by hub.freebsd.org (Postfix) with ESMTP id 9A98337B408; Fri, 13 Jul 2001 16:32:40 -0700 (PDT) (envelope-from babkin@bellatlantic.net) Received: from bellatlantic.net (client-151-198-135-220.nnj.dialup.bellatlantic.net [151.198.135.220]) by smtp6ve.mailsrvcs.net (8.9.1/8.9.1) with ESMTP id XAA42114564; Fri, 13 Jul 2001 23:32:32 GMT Message-ID: <3B4F850F.28ABECBD@bellatlantic.net> Date: Fri, 13 Jul 2001 19:32:31 -0400 From: Sergey Babkin X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 4.0-19990626-CURRENT i386) X-Accept-Language: en, ru MIME-Version: 1.0 To: Alfred Perlstein Cc: Greg Lehey , y-carden@uniandes.edu.co, FreeBSD Hackers Subject: Re: Some questions about kernel programming References: <20010713113822.V45037@wantadilla.lemis.com> <20010712212809.F6664@sneakerz.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Alfred Perlstein wrote: > > * Greg Lehey [010712 21:08] wrote: > > On Thursday, 12 July 2001 at 6:58:09 -0500, y-carden@uniandes.edu.co wrote: > > > Dear Friends > > > > > > I have some questions about kernel programming: > > > > You'd be better off sending mail like this to -hackers. I've followed > > up there. > > I also got this in private mail, hrmm.. > > > write() doesn't exist in the kernel. The simple answer is "you're > > going to have to read what the send() syscall does and emulate it". > > First, though, you need to answer the question "why do I want to do > > this in the kernel?" > > it actually exists, however the problem is that copyin and friends > assume a seperate address space, I wonder if one could do some trick > to alias the seperate address space on top of the kernel, that should > allow copyin and friends to work on pointers into the kernel's address > space. Such as looking at dofilewrite() which is what write() calls internally. dofilewrite() fills up a struct uio and calls the file descriptor's filesystem-dependent write routine. The difference for writing from kernel would be using UIO_SYSSPACE instead of UIO_USERSPACE when preparing the uio structure. -SB To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message