From owner-freebsd-hackers@FreeBSD.ORG Tue May 15 06:47:44 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A4BDE16A402 for ; Tue, 15 May 2007 06:47:44 +0000 (UTC) (envelope-from marc.loerner@hob.de) Received: from mailgate.hob.de (mailgate.hob.de [212.185.199.3]) by mx1.freebsd.org (Postfix) with ESMTP id 63AB213C459 for ; Tue, 15 May 2007 06:47:44 +0000 (UTC) (envelope-from marc.loerner@hob.de) Received: from localhost (localhost.localdomain [127.0.0.1]) by mailgate.hob.de (Postfix) with ESMTP id 480EC27E4C; Tue, 15 May 2007 08:47:43 +0200 (CEST) Received: from mailgate.hob.de ([127.0.0.1]) by localhost (mailgate.hob.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31154-07; Tue, 15 May 2007 08:47:43 +0200 (CEST) Received: from imap.hob.de (mail2.hob.de [172.25.1.102]) by mailgate.hob.de (Postfix) with ESMTP id 115F127DB4; Tue, 15 May 2007 08:47:43 +0200 (CEST) Received: from linux03.hob.de (linux03.hob.de [172.22.0.190]) by imap.hob.de (Postfix on SuSE eMail Server 2.0) with ESMTP id 27DA930DD6; Tue, 15 May 2007 08:47:42 +0200 (CEST) From: Marc =?iso-8859-1?q?L=F6rner?= Organization: hob To: freebsd-hackers@freebsd.org Date: Tue, 15 May 2007 07:47:38 +0100 User-Agent: KMail/1.6.2 References: <4649349D.4060101@room52.net> In-Reply-To: <4649349D.4060101@room52.net> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Message-Id: <200705150847.38838.marc.loerner@hob.de> X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at hob.de Cc: Lawrence Stewart Subject: Re: Writing a plain text file to disk from kernel space X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 May 2007 06:47:44 -0000 Hello Lawrence, in file kern/vfs_syscalls.c you can see the kern_open function that uses vn_open to open a file/vnode. There are more vn_* functions like vn_rdwr for reading and writing to a vnode or vn_close to close a vnode. To see how theses functions work, I suggest you grep for them in the kernel-files. BTW, you can get an thread-struct pointer from curthread (c.f. sys/pcpu.h). HTH, Marc Lörner