Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Sep 2004 15:51:45 +0300 (EEST)
From:      Jari Kirma <kirma@cs.hut.fi>
To:        freebsd-hackers@freebsd.org
Subject:   Re: execute a user process in the kernel
Message-ID:  <Pine.GSO.4.61.0409221542280.29838@hutcs.cs.hut.fi>

next in thread | raw e-mail | index | archive | help

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?

> 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, what shall I do?

Proper way to do this is to have userland daemon handling this stuff, 
waiting for device driver using device-specific method (most likely 
a file under /dev). I'm pretty skeptic processes that don't have init 
process as their first ancestor can be created easily at all.

There's also another question to consider: where the output should go? 
These kind of things are better to be handled in the userland.

-kirma



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