From owner-freebsd-hackers Wed Jan 8 13:45:25 2003 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 B51E737B401 for ; Wed, 8 Jan 2003 13:45:24 -0800 (PST) Received: from flavatown.mail.pas.earthlink.net (flavatown.mail.pas.earthlink.net [207.217.120.148]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3748A43ED1 for ; Wed, 8 Jan 2003 13:45:24 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from stork (stork.mail.pas.earthlink.net [207.217.120.188]) by flavatown.mail.pas.earthlink.net (8.11.6+Sun/8.11.6) with ESMTP id h08LHWf11687 for ; Wed, 8 Jan 2003 13:17:32 -0800 (PST) Received: from pool0118.cvx22-bradley.dialup.earthlink.net ([209.179.198.118] helo=mindspring.com) by stork with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 18WNZh-0002B1-00; Wed, 08 Jan 2003 13:17:22 -0800 Message-ID: <3E1C9506.FD69C710@mindspring.com> Date: Wed, 08 Jan 2003 13:15:50 -0800 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: omestre Cc: freebsd-hackers@freebsd.org Subject: Re: read in kernel mode... References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4100b16ca8b273584542bcd60a96a0aa5350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c 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 omestre wrote: > Hello, > I need read some data in kernel mode... Somebody can help me? > I have tried with read function, but i got segmentation fault... > And i can't use the stdio.h :) then, how can i do this job??? The problem you are having is because you do not have a process address space context for the copyout() to user space that's built into the read(2) routine: you can not use the read(2) routine directly from a kernel context, and you can only use it from an adopted process context if you expend a great deal of effort. You probably need to ask yourself three things: 1) What problem are you really trying to solve here, that makes you think you need to do file I/O in the kernel? 2) Have you considered other solutions to the problem, ones which do not require file I/O in the kernel? 3) Have you looked at the mailing list archives, to see the three documented methods of doing this evil thing, which people have already hashed out? -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message