Re: execute a user process in the kernel

2004-09-25 Thread Dag-Erling Smørgrav
Bruce M Simpson <[EMAIL PROTECTED]> writes: > On Sat, Sep 25, 2004 at 01:35:07PM +0200, Dag-Erling Smørgrav wrote: > > > If we were to implement POSIX spawn(), we'd need something like this. > > Uh, no. posix_spawn(3) can be implemented entirely in userland and > > does not require any special ker

Re: execute a user process in the kernel

2004-09-25 Thread Bruce M Simpson
On Sat, Sep 25, 2004 at 01:35:07PM +0200, Dag-Erling Smørgrav wrote: > > If we were to implement POSIX spawn(), we'd need something like this. > > Uh, no. posix_spawn(3) can be implemented entirely in userland and > does not require any special kernel support. Discussions with peter@ and others

Re: execute a user process in the kernel

2004-09-25 Thread Dag-Erling Smørgrav
Bruce M Simpson <[EMAIL PROTECTED]> writes: > On Fri, Sep 24, 2004 at 06:21:25PM +0200, Dag-Erling Smørgrav wrote: > > You could, of course, write a kernel API for creating processes from > > scratch. They'd still need a parent, but you can use init(8) (pid 1) > > for that. > If we were to impleme

Re: execute a user process in the kernel

2004-09-25 Thread Bruce M Simpson
On Fri, Sep 24, 2004 at 06:21:25PM +0200, Dag-Erling Smørgrav wrote: > You could, of course, write a kernel API for creating processes from > scratch. They'd still need a parent, but you can use init(8) (pid 1) > for that. If we were to implement POSIX spawn(), we'd need something like this. So t

Re: execute a user process in the kernel

2004-09-24 Thread Dag-Erling Smørgrav
Robert Watson <[EMAIL PROTECTED]> writes: > Well, we have kproc/kthread APIs, but none of that is semantically > compatible with the notion of execve(), which is a very user-centric > concept ("replace the address space with a mapping of binary "). You > could fudge together a related notion, thou

Re: execute a user process in the kernel

2004-09-24 Thread Robert Watson
On Fri, 24 Sep 2004, Dag-Erling Smørgrav wrote: > execve(2) assumes you already have a process. You get a process by > forking another process. The only process we ever create from scratch > is init(8), and that takes a s**tload of work (see kern/init_main.c). > This is why we have stuff like

Re: execute a user process in the kernel

2004-09-24 Thread Dag-Erling Smørgrav
Mike Meyer <[EMAIL PROTECTED]> writes: > Gordon David <[EMAIL PROTECTED]> writes: > > Kqueue is a good method to notify the user. But I want the code in > > the kernel directly calls a user program. > How about starting with the code in kern/kern_exec.c? execve(2) assumes you already have a proces

Re: execute a user process in the kernel

2004-09-24 Thread Mike Meyer
In <[EMAIL PROTECTED]>, Gordon David <[EMAIL PROTECTED]> typed: > > >From: "Bjoern A. Zeeb" <[EMAIL PROTECTED]> > >To: Gordon David <[EMAIL PROTECTED]> > >CC: [EMAIL PROTECTED] > >Subject: Re: execute a user process in the kernel >

Re: execute a user process in the kernel

2004-09-23 Thread Jari Kirma
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 wor

Re: execute a user process in the kernel

2004-09-23 Thread Bruce M Simpson
On Thu, Sep 23, 2004 at 08:18:14AM +, Gordon David wrote: > Kqueue is a good method to notify the user. But I want the code in the > kernel directly calls a user program. This is Very, Very Hard indeed, because it's not something supported by the system, but it should be possible. Look at cre

Re: execute a user process in the kernel

2004-09-23 Thread Gordon David
From: "Bjoern A. Zeeb" <[EMAIL PROTECTED]> To: Gordon David <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED] Subject: Re: execute a user process in the kernel Date: Thu, 23 Sep 2004 08:02:18 + (UTC) On Thu, 23 Sep 2004, Gordon David wrote: > That's the point. I do no

Re: execute a user process in the kernel

2004-09-23 Thread Bjoern A. Zeeb
On Thu, 23 Sep 2004, Gordon David wrote: > That's the point. I do not want the userland program to check /dev/fooctl > from time to time. I want the kernel to notify the userland program > instead. So how shall I do it? Maybe linker_load_file is a better way. man 2 kqueue ? -- Bjoern A. Zeeb

Re: execute a user process in the kernel

2004-09-23 Thread Gordon David
> On Wed, Sep 22, 2004 at 08:49:11AM +, 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. Readi

Re: execute a user process in the kernel

2004-09-22 Thread Chris Pressey
On Wed, 22 Sep 2004 18:46:49 -0400 Allan Fields <[EMAIL PROTECTED]> wrote: > On Wed, Sep 22, 2004 at 08:49:11AM +, 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 d

Re: execute a user process in the kernel

2004-09-22 Thread Allan Fields
On Wed, Sep 22, 2004 at 08:49:11AM +, 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

execute a user process in the kernel

2004-09-22 Thread Gordon David
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,