Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Dec 1998 06:53:26 -0500 (EST)
From:      Alfred Perlstein <bright@hotjobs.com>
To:        hackers@FreeBSD.ORG
Subject:   how to have the kernel spawn a process?
Message-ID:  <Pine.BSF.4.05.9812310558440.37756-100000@bright.fx.genx.net>

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

I would like to have the kernel spawn a process and be able to control it.

1) fork1(&proc0, RFFDG|RFPROC)
2) cpu_set_fork_handler(pfind(proc0.p_retval[0]), &func_to_exec, args);
3) before execve'ing the process, set a flag to note that it's running,
the flag would have the pid if the current process. (normally it would be
0, or -1)
4) setup an at_exit() handler to reset the flag
5) overlay the vty of the current syscons screen over the stdin/stdout of
the process (*)
6) execve /usr/libexec/savers/mine

Basically i want syscons to be able to exec a usermode screensaver but
still maintain control over it in a failsafe fashion.  Something really
bugs me about screen savers being kernel modules. :)

if anyone wants to give hints as how to go about #5 i'd be much
appreciative.

note that when syscons gets input it can:

1) check the flag, (if 0, saver died, goto 8)
2) signal the screen saver for a graceful shutdown,
3) tsleep, 
4) check flag, (if 0, saver terminated gracefully(?), goto 8) 
5) kill -9, 
6) tsleep
7) check flag, (if !0, goto 6 (it has to die sometime right?)) 
8) restore screen.

(this might be invalid, i'm unsure if the input is at interupt time, or
normal time, but i'm sure i could hook it correctly)

suggestions? comments?

Alfred Perlstein - Programmer, HotJobs Inc. - www.hotjobs.com
-- There are operating systems, and then there's FreeBSD.
-- http://www.freebsd.org/                        3.0-current


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



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