Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Dec 2002 11:54:39 -0800 (PST)
From:      David Leimbach <leimy2k@mac.com>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        freebsd-doc@FreeBSD.org
Subject:   RE: Error in example for Kernel module....
Message-ID:  <6291614.1040154879452.JavaMail.leimy2k@mac.com>

next in thread | raw e-mail | index | archive | help

On Tuesday, Dec 17, 2002, at 11:33AM, John Baldwin <jhb@FreeBSD.org> 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 <jhb@FreeBSD.org>  <><  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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6291614.1040154879452.JavaMail.leimy2k>