From owner-freebsd-hackers@FreeBSD.ORG Wed Sep 22 22:46:50 2004 Return-Path: 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 42BCD16A4CE for ; Wed, 22 Sep 2004 22:46:50 +0000 (GMT) Received: from afields.ca (afields.ca [216.194.67.132]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0FDB743D45 for ; Wed, 22 Sep 2004 22:46:50 +0000 (GMT) (envelope-from afields@afields.ca) Received: from afields.ca (localhost.afields.ca [127.0.0.1]) by afields.ca (8.12.11/8.12.11) with ESMTP id i8MMknXZ086057; Wed, 22 Sep 2004 18:46:49 -0400 (EDT) (envelope-from afields@afields.ca) Received: (from afields@localhost) by afields.ca (8.12.11/8.12.11/Submit) id i8MMkn2w086056; Wed, 22 Sep 2004 18:46:49 -0400 (EDT) (envelope-from afields) Date: Wed, 22 Sep 2004 18:46:49 -0400 From: Allan Fields To: Gordon David Message-ID: <20040922224649.GG47410@afields.ca> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i cc: freebsd-hackers@freebsd.org Subject: Re: execute a user process in the kernel X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2004 22:46:50 -0000 On Wed, Sep 22, 2004 at 08:49:11AM +0000, Gordon David wrote: > Hello, > > I have a question. Anyone would like to tell me how to execute a user > process or shell script in the kernel? You probably really don't want to do this and if you do, there is likely a better approach. > As we know, the kernel forks a process named initproc and executes > /sbin/init, etc. If I want to execute a user level process, such as a > simple printf("Hello world") in a driver Why? > what shall I do? Lots of good references on distinctions between kernel and userland. Try: The Design and Implementation of 4.4BSD (First few chapters) file:///usr/share/doc/en/books/design-44bsd/ > Thanks > Gordon -- Allan Fields, AFRSL - http://afields.ca 2D4F 6806 D307 0889 6125 C31D F745 0D72 39B4 5541