From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 10:19:14 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B79C0106564A for ; Tue, 4 Aug 2009 10:19:14 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mx1.freebsd.org (Postfix) with ESMTP id 384758FC15 for ; Tue, 4 Aug 2009 10:19:13 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: by bwz2 with SMTP id 2so2826769bwz.43 for ; Tue, 04 Aug 2009 03:19:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Cb1MFQur8Nbt8Zt8Q9CGOZSTPmyxKUrTgP7oNSZd2is=; b=rf53Go1BfJUfCq9qu61ppe5b+4+LHRuEBiiTPqLF93pWYI4t6GEYZtlrpf4eVxQapm 0lwG03vBpoOYZVVcpJiZ6u1y+T4qIyp7cIsTIw9hoiQfwupmfjVinaX7UqQ7JfFvbii1 xH1QRoQq3xThlkUc6mPPnHqn666G0Rwnx0+sE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=NAv17G8DOHWSc8pQApzCvDuhyGslKMyKqQXb1cZRrfXckjzFRDt60AWSrnDwkw6M4f 4FhrcVZKVCl4Co+ywJs4jMDaHZbiQpCj/wvz8a1X4Ep+ED6izjYRagcqwe0ChFdQlKKU rON4WCvW7CKR5xRzGpSuuN4aDI0AZx3nijj8A= MIME-Version: 1.0 Received: by 10.204.54.4 with SMTP id o4mr10386534bkg.208.1249381152989; Tue, 04 Aug 2009 03:19:12 -0700 (PDT) In-Reply-To: <319cceca0908040259q4537db80uc2ce9696f30bfc12@mail.gmail.com> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> <20090804094142.GO1292@hoeg.nl> <319cceca0908040252w105d3dfdge9dec3c8b6d28607@mail.gmail.com> <20090804095650.GP1292@hoeg.nl> <319cceca0908040259q4537db80uc2ce9696f30bfc12@mail.gmail.com> Date: Tue, 4 Aug 2009 10:19:12 +0000 Message-ID: <319cceca0908040319x35bc8bcy7a869dd230419a50@mail.gmail.com> From: Maslan To: Ed Schouten Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: FreeBSD Hackers Subject: Re: sosend() and mbuf X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2009 10:19:15 -0000 OpenKETA has its own kthread_create() with a little modification from kthread_create(), it associates the new thread with curthread not with the thread0. See /usr/sys/kern/kern_kthread.c: kthread_create() error = fork1(&thread0, RFMEM | RFFDG | RFPROC | RFSTOPPED | flags, pages, &p2); OpenKETA:kthread_create() error = fork1(curthread, RFFDG | RFPROC | RFSTOPPED | flags, pages, &p2); I'll give it a try and see if it works. BUT i still can't understand why kern_open() don't work, except in the original thread. On Tue, Aug 4, 2009 at 9:59 AM, Maslan wrote: > yes kio http://people.freebsd.org/~pjd/misc/kernio/ > However, It's outdated. > > On Tue, Aug 4, 2009 at 9:56 AM, Ed Schouten wrote: >> * Maslan wrote: >>> > Is it possible to call kern_open() from within a kernel thread anyway? >>> I think yes, It worked on the parent thread before creating a new kthread. >>> See OpenKETA source, its using the same approach. >>> > kern_open() depends on a file descriptor table, right? >>> Yes, it returns a fd in the curthread->td_retval[0], which i should >>> use within the same thread to deal with this file. >> >> Didn't someone (Jeff Roberson?) develop some nice in-kernel API for >> accessing files some years ago? Why not use that? >> >> -- >> Ed Schouten >> WWW: http://80386.nl/ >> >