From owner-freebsd-hackers Thu Dec 31 03:50:04 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id DAA20646 for freebsd-hackers-outgoing; Thu, 31 Dec 1998 03:50:04 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from bright.fx.genx.net (bright.fx.genx.net [206.64.4.154]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id DAA20641 for ; Thu, 31 Dec 1998 03:50:02 -0800 (PST) (envelope-from bright@hotjobs.com) Received: from localhost (bright@localhost) by bright.fx.genx.net (8.9.1/8.9.1) with ESMTP id GAA38344 for ; Thu, 31 Dec 1998 06:53:27 -0500 (EST) (envelope-from bright@hotjobs.com) X-Authentication-Warning: bright.fx.genx.net: bright owned process doing -bs Date: Thu, 31 Dec 1998 06:53:26 -0500 (EST) From: Alfred Perlstein X-Sender: bright@bright.fx.genx.net To: hackers@FreeBSD.ORG Subject: how to have the kernel spawn a process? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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