From owner-freebsd-current@FreeBSD.ORG Mon Aug 27 18:40:39 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D7A9106566B; Mon, 27 Aug 2012 18:40:39 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 708A48FC22; Mon, 27 Aug 2012 18:40:39 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id ACEF9B9A5; Mon, 27 Aug 2012 14:40:38 -0400 (EDT) From: John Baldwin To: freebsd-current@freebsd.org Date: Mon, 27 Aug 2012 12:27:54 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <20120827073403.GA49223@onelab2.iet.unipi.it> <503B2803.1010104@FreeBSD.org> In-Reply-To: <503B2803.1010104@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201208271227.54785.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 27 Aug 2012 14:40:38 -0400 (EDT) Cc: Luigi Rizzo , current@freebsd.org, Andriy Gapon Subject: Re: per file descriptor device callbacks ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 18:40:39 -0000 On Monday, August 27, 2012 3:55:47 am Andriy Gapon wrote: > on 27/08/2012 10:34 Luigi Rizzo said the following: > > This requires to track calls to open/ioctl/poll/mmap/close. > > The difficulty i have is with mmap() and close(), because FreeBSD > > seems to handle these calls per-cdev rather than per-file-descriptor > > (for instance, no 'struct file' argument is available in mmap(), and > > the d_close method is only called on the last close() on the device). > > devfs_set_cdevpriv(9), etc mmap() is still problematic, but if you have the freedom to create your own VM objects, then d_mmap_single() can let you handle that fairly easily. -- John Baldwin