From owner-freebsd-doc Tue Dec 17 11:54:42 2002 Delivered-To: freebsd-doc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E317A37B401; Tue, 17 Dec 2002 11:54:40 -0800 (PST) Received: from smtpout.mac.com (A17-250-248-88.apple.com [17.250.248.88]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8D7EE43ED8; Tue, 17 Dec 2002 11:54:40 -0800 (PST) (envelope-from leimy2k@mac.com) Received: from woappsx14.mac.com (woappsx14-en1 [10.13.10.114]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id gBHJsdBZ017744; Tue, 17 Dec 2002 11:54:40 -0800 (PST) Received: from woappsx14 (localhost [127.0.0.1]) by woappsx14.mac.com (8.10.2/8.10.2) with ESMTP id gBHJsdD10440; Tue, 17 Dec 2002 11:54:39 -0800 (PST) Message-ID: <6291614.1040154879452.JavaMail.leimy2k@mac.com> Date: Tue, 17 Dec 2002 11:54:39 -0800 (PST) From: David Leimbach To: John Baldwin Subject: RE: Error in example for Kernel module.... Cc: freebsd-doc@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Tuesday, Dec 17, 2002, at 11:33AM, John Baldwin wrote: > >On 17-Dec-2002 David Leimbach wrote: >> I think so anyway... >> >> http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/ >> x10109.html >> >> In : >> >> static int >> echo_loader(struct module *m, int what, void *arg) >> { >> int err = 0; >> >> switch (what) { >> case MOD_LOAD: /* kldload */ >> sdev = make_dev(&echo_cdevsw, >> 0, >> UID_ROOT, >> GID_WHEEL, >> 0600, >> "echo"); >> /* kmalloc memory for use by this driver */ >> /* malloc(256,M_ECHOBUF,M_WAITOK); */ >> MALLOC(echomsg, t_echo *, sizeof(t_echo), M_ECHOBUF, M_WAITOK); >> printf("Echo device loaded.\n"); >> break; >> >> Should probably be: >> uprintf("Echo device loaded\n"); >> >> This is probably minor... > >You can use printf in the kernel directly. > Yes. I was just thinking that for consistency it might be good to stick to one style of output. Don't printf statements get written to logs in FBSD... Sorry I am such a newbie to FBSD kernel stuff... I think it was printk in linux that went to logs and printf in FreeBSD that went to the terminal. For example modules it might be good not to pollute the logs since we are not told to look at them in the example IIRC. Also... These aren't up to date for FreeBSD 5.0. Is this being changed as we speak or will that be in some other documentation elsewhere. The echo_read and echo_write should refer to threads not procs as the last parameter to the functions for FreeBSD 5.0. Dave >-- > >John Baldwin <>< http://www.FreeBSD.org/~jhb/ >"Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message