From owner-freebsd-drivers@FreeBSD.ORG Tue Oct 18 03:09:35 2005 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CDAE316A41F for ; Tue, 18 Oct 2005 03:09:35 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 643AA43D45 for ; Tue, 18 Oct 2005 03:09:35 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1] (may be forged)) by harmony.bsdimp.com (8.13.3/8.13.3) with ESMTP id j9I38cs4016223; Mon, 17 Oct 2005 21:08:39 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 17 Oct 2005 21:09:55 -0600 (MDT) Message-Id: <20051017.210955.104032631.imp@bsdimp.com> To: bharmaji@gmail.com From: "M. Warner Losh" In-Reply-To: <67beabb0510171825q1e124bf6v2adbe0c9f235a6ae@mail.gmail.com> References: <67beabb0510171825q1e124bf6v2adbe0c9f235a6ae@mail.gmail.com> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Mon, 17 Oct 2005 21:08:39 -0600 (MDT) Cc: freebsd-drivers@freebsd.org Subject: Re: Recommended ways to log driver operations X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2005 03:09:36 -0000 In message: <67beabb0510171825q1e124bf6v2adbe0c9f235a6ae@mail.gmail.com> Bharma Ji writes: : I recently wrote a driver for a chip. I am wondering if there are any : standard recommended ways of logging the driver operations. I have used : printf in the driver and I look at it using dmesg so far. Am wondering if it : is possible to create a driver specific log file so that it is easy to : debug. Also, if the driver emits copious output then the log buffer will : overflow and some messages may be truncated. Writing to a specific log file : may help in that case. However, I have no idea if this is worth : investigating. Any suggestions appreciated printf(9) doesn't give you much of a chance to segregate the logs. You can also use log(9), but that just adds the ability to give a priority to the log message, which can help. If you want to debug the driver to find out what's going on at a high rate, you might want to look at ktr(9) and alq(9). These facilities are more for debugging and performance tuning, rather than day to day operations. In general, FreeBSD drivers follow the unix tradition of only complaining when there are problems. Warner