From owner-freebsd-hackers@FreeBSD.ORG Thu May 6 18:12:10 2010 Return-Path: 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 2AE141065673 for ; Thu, 6 May 2010 18:12:10 +0000 (UTC) (envelope-from freebsd-hackers@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id D908B8FC14 for ; Thu, 6 May 2010 18:12:09 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OA5YO-0004lX-D8 for freebsd-hackers@freebsd.org; Thu, 06 May 2010 20:12:08 +0200 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 06 May 2010 20:12:08 +0200 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 06 May 2010 20:12:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-hackers@freebsd.org connect(): No such file or directory From: Ivan Voras Date: Thu, 06 May 2010 20:12:07 +0200 Lines: 22 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.8) Gecko/20100329 Thunderbird/3.0.3 In-Reply-To: X-Enigmail-Version: 1.0.1 Subject: Re: How to get data from kernel module ? 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, 06 May 2010 18:12:10 -0000 On 05/06/10 15:38, Lukáš Czerner wrote: > Hi, > > I am creating a kernel module and I need to get some information from > that module. I can do this with ioctl and pass the data to the > user space but it seems a bit unpractical to me, because I do not know > the amount of the data - it can differ. I do not know of any way to > pass a list of structures to the userspace through ioctl - is there > any? > > So my question is, is there any standard way in FreeBSD to do this ? > In linux I would probably use the sysfs, but in FreeBSD I can not find > anything similar, except just creating some virtual filesystem on my > own and obviously this is not what I want to do. As others said, sysctl is one way to go, but might not be very convenient if the amount of data is large. I'd rather setup a device and a simple protocol to read/write to/from it. http://www.freebsd.org/doc/en/books/arch-handbook/driverbasics-char.html (you want the 5+ version)