From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 27 22:46:14 2011 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 C09B01065673; Wed, 27 Apr 2011 22:46:14 +0000 (UTC) (envelope-from freebsd@chillt.de) Received: from dd16434.kasserver.com (dd16434.kasserver.com [85.13.137.111]) by mx1.freebsd.org (Postfix) with ESMTP id 7CD0F8FC12; Wed, 27 Apr 2011 22:46:14 +0000 (UTC) Received: from taiko.lan (ppp-197-43.21-151.libero.it [151.21.43.197]) by dd16434.kasserver.com (Postfix) with ESMTPSA id 4467A18860EE; Thu, 28 Apr 2011 00:46:13 +0200 (CEST) Message-ID: <4DB89C9E.1070004@chillt.de> Date: Thu, 28 Apr 2011 00:45:50 +0200 From: Bartosz Fabianowski User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110309 Thunderbird/3.1.9 MIME-Version: 1.0 To: Kostik Belousov References: <4DB695DB.1080505@chillt.de> <201104271019.31844.jhb@freebsd.org> <4DB818A3.1020104@chillt.de> <201104271334.07170.jhb@freebsd.org> <4DB8873C.5020608@chillt.de> <20110427215228.GY48734@deviant.kiev.zoral.com.ua> <4DB89559.3080008@chillt.de> <20110427223811.GA48734@deviant.kiev.zoral.com.ua> In-Reply-To: <20110427223811.GA48734@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, Hans Petter Selasky Subject: Re: Is there some implicit locking of device methods? 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: Wed, 27 Apr 2011 22:46:14 -0000 > This is a strange architecture, esp. amusing is the kernel-mode > traffic multiplier. This mimics the Linux input events framework. The architecture is not mine, I am just implementing it under FreeBSD. > - use usermode daemon that multiplies traffic for all connected > clients; A better architecture for sure - but I want to stay compatible with code written for Linux and so must provide concurrent access via a single device node. > - or, implement a ring buffer that cyclically stores the received > data, and keep only the current read pointer in the cdevpriv. Good idea. This will save a few kilobytes of memory. > You need to handle the overflow case (eq. to the stuck reader) > somehow in the current scheme anyway. Reader may now read from its > current read position in the buffer up to the fill point. If the > buffer wrapped for the reader, it should get some error. Yes, of course. I am checking the queue fill state and making sure not to overflow it. - Bartosz