From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 24 18:22:10 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B199516A4E5 for ; Thu, 24 Aug 2006 18:22:10 +0000 (UTC) (envelope-from kim@tinker.com) Received: from tinker.com (tinker2-3.august.net [66.228.55.4]) by mx1.FreeBSD.org (Postfix) with SMTP id A271C43D4C for ; Thu, 24 Aug 2006 18:22:02 +0000 (GMT) (envelope-from kim@tinker.com) Received: (qmail 99166 invoked by uid 27); 24 Aug 2006 18:20:04 -0000 Received: from 204.10.126.26.tinker.com(204.10.126.26), claiming to be "[192.42.172.22]" via SMTP by pop.tinker.com, id smtpdDmLNeZ; Thu Aug 24 13:19:59 2006 In-Reply-To: <84dead720608232056o183976ffidc1c506434e754b9@mail.gmail.com> References: <77B636A3-5AED-41E6-AB98-91178E1D10D8@tinker.com> <84dead720608232056o183976ffidc1c506434e754b9@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Kim Shrier Date: Thu, 24 Aug 2006 12:21:53 -0600 To: Joseph Koshy X-Mailer: Apple Mail (2.752.2) Cc: FreeBSD Hackers Subject: Re: The proper way to open a file from inside the kernel 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: Thu, 24 Aug 2006 18:22:10 -0000 On Aug 23, 2006, at 9:56 PM, Joseph Koshy wrote: >> I am experimenting with modifying a kernel module and I need >> to be able to open/read/write/close a file from within the >> module. Is there a preferred way to do this? Are there any >> locking or buffering issues that I need to be aware of? > > sys/kern/kern_alq.c:alq_open() and sys/kern/kern_ktrace.c:ktrace() > have examples. > > -- > FreeBSD Volunteer, http://people.freebsd.org/~jkoshy > Thank you. Kim -- Kim Shrier - principal, Shrier and Deihl - mailto:kim@tinker.com Remote Unix Network Admin, Security, Internet Software Development Tinker Internet Services - Superior FreeBSD-based Web Hosting http://www.tinker.com/