From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 13 19:50:27 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 80DAD16A41F; Mon, 13 Jun 2005 19:50:27 +0000 (GMT) (envelope-from julian@elischer.org) Received: from bigwoop.vicor-nb.com (bigwoop.vicor-nb.com [208.206.78.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2B8A843D1F; Mon, 13 Jun 2005 19:50:26 +0000 (GMT) (envelope-from julian@elischer.org) Received: from [208.206.78.97] (julian.vicor-nb.com [208.206.78.97]) by bigwoop.vicor-nb.com (Postfix) with ESMTP id 794577A403; Mon, 13 Jun 2005 12:50:26 -0700 (PDT) Message-ID: <42ADE382.4010403@elischer.org> Date: Mon, 13 Jun 2005 12:50:26 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.7) Gecko/20050423 X-Accept-Language: en, hu MIME-Version: 1.0 To: Scott Long References: <42ADC762.6010801@elischer.org> <20050613181435.GA3096@infradead.org> <42ADD253.4020606@samsco.org> In-Reply-To: <42ADD253.4020606@samsco.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Daniel Eischen , Apache Xie , freebsd-hackers@freebsd.org Subject: Re: contigmalloc() and mmap() 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: Mon, 13 Jun 2005 19:50:27 -0000 Scott Long wrote: > Christoph Hellwig wrote: > >> On Mon, Jun 13, 2005 at 10:50:26AM -0700, Julian Elischer wrote: >> >>> Several times in the past we've seen people complainign that Linux >>> allows a device driver to know >>> who called it and somehow it seems to store somewhere some >>> information about who >>> openned the device.. thos somehow allows linux to store an arbitrary >>> structure >>> for each openning process. I thin from the sond of it that he wants >>> to do something >>> similar. From the sond of it he wants to have a different buffer be >>> used depending on >>> who is calling. This would partly work but would not work when >>> processes fork etc. >>> >>> I think Linux must do some extra housekeeping in this case. >> >> >> >> What Linux does is pretty simple. The driver has access to the file >> structure, and this structure has a field for driver private data. >> It can store private data in open and free it again in the release >> callback. >> > > How does linux handle the implications of fork(2) in this scenario? both processes get the same field.. I don't think there is any special handling.. that would require a "forking" handler in each driver. In practice it seems ot not be a problem. > > Scott