From owner-freebsd-hackers@FreeBSD.ORG Fri Sep 24 16:21:26 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F123C16A4CF for ; Fri, 24 Sep 2004 16:21:26 +0000 (GMT) Received: from mail.broadpark.no (mail.broadpark.no [217.13.4.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id A306943D53 for ; Fri, 24 Sep 2004 16:21:26 +0000 (GMT) (envelope-from des@des.no) Received: from dwp.des.no (37.80-203-228.nextgentel.com [80.203.228.37]) by mail.broadpark.no (Postfix) with ESMTP id 9D5A216C7; Fri, 24 Sep 2004 18:22:07 +0200 (MEST) Received: by dwp.des.no (Postfix, from userid 2602) id 9E014B85E; Fri, 24 Sep 2004 18:21:25 +0200 (CEST) To: Mike Meyer References: <16722.59709.451226.932084@guru.mired.org> From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) Date: Fri, 24 Sep 2004 18:21:25 +0200 In-Reply-To: <16722.59709.451226.932084@guru.mired.org> (Mike Meyer's message of "Thu, 23 Sep 2004 10:18:21 -0500") Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable cc: bzeeb-lists@lists.zabbadoz.net cc: Gordon David cc: freebsd-hackers@freebsd.org Subject: Re: execute a user process in the kernel X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2004 16:21:27 -0000 Mike Meyer writes: > Gordon David 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 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 nfsiod(8) which does nothing but provide the kernel with a process context it can use for other stuff. 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. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no