[prev in list] [next in list] [prev in thread] [next in thread]
List: freebsd-hackers
Subject: how to have the kernel spawn a process?
From: Alfred Perlstein <bright () hotjobs ! com>
Date: 1998-12-31 11:53:26
[Download RAW message or body]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic