Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Sep 2004 18:46:49 -0400
From:      Allan Fields <bsd@afields.ca>
To:        Gordon David <kylincsos@hotmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: execute a user process in the kernel
Message-ID:  <20040922224649.GG47410@afields.ca>
In-Reply-To: <BAY1-F12o3npvqnJNeO00048b8a@hotmail.com>
References:  <BAY1-F12o3npvqnJNeO00048b8a@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040922224649.GG47410>