From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 15 19:37:23 2010 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 2C89C1065674 for ; Mon, 15 Nov 2010 19:37:23 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from out-0.mx.aerioconnect.net (out-0-9.mx.aerioconnect.net [216.240.47.69]) by mx1.freebsd.org (Postfix) with ESMTP id 0DB818FC1B for ; Mon, 15 Nov 2010 19:37:22 +0000 (UTC) Received: from idiom.com (postfix@mx0.idiom.com [216.240.32.160]) by out-0.mx.aerioconnect.net (8.13.8/8.13.8) with ESMTP id oAFJbM5v022445; Mon, 15 Nov 2010 11:37:22 -0800 X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (h-67-100-89-137.snfccasy.static.covad.net [67.100.89.137]) by idiom.com (Postfix) with ESMTP id BAD852D6019; Mon, 15 Nov 2010 11:37:21 -0800 (PST) Message-ID: <4CE18BF3.4080301@freebsd.org> Date: Mon, 15 Nov 2010 11:37:23 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 MIME-Version: 1.0 To: Paul LeoNerd Evans References: <20101112184000.GS11110@cel.leo> <201011151125.42697.jhb@freebsd.org> <20101115181211.GV11110@cel.leo> <4CE17CF5.6050107@freebsd.org> <20101115183807.GW11110@cel.leo> In-Reply-To: <20101115183807.GW11110@cel.leo> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 216.240.47.51 Cc: freebsd-hackers@freebsd.org Subject: Re: Managing userland data pointers in kqueue/kevent 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, 15 Nov 2010 19:37:23 -0000 On 11/15/10 10:38 AM, Paul LeoNerd Evans wrote: > On Mon, Nov 15, 2010 at 10:33:25AM -0800, Julian Elischer wrote: >> it was provided for pretty much what you are using it for, so that >> the userland caller could >> easily associate the returning event with some private information >> about the event. > This was indeed the impression I got. With reference to my original > questions regarding its use, perhaps you could suggest some way to > actually use this API then, in order to solve my problem? > > Unless there's some subtle detail or trick I have misunderstood, it > doesn't appear to be easily possible in this manner. > > How would you suggest I manage these pointers and data structures? > I don't think it was thought of in the context of reference counted items. you could use an ever increasing number that you hash on a hash table. if the kernel returns a number that is out of date you won't find it and you can ignore it. If the kernel returns a number you are currently tracking. then you use the item associated with that entry.