tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kernel panic with new pseudo device
On Thu, May 21, 2009 at 11:00 AM, Quentin Garnier <cube%cubidou.net@localhost>
wrote:
> On Thu, May 21, 2009 at 09:24:31AM -0400, matthew sporleder wrote:
>> Hi, I'm trying to write a pseudo device with an envsys component. I
>> mostly followed http://www.netbsd.org/docs/kernel/pseudo/ and got a
>> working device, but now I get a panic when I attempt to do:
>> sc->sc_sme = sysmon_envsys_create();
>>
>> My best guess is that I didn't get any memory allocated for my _softc
>> structure, but I'm not really sure how to validate that.
>>
>> A rough cut of my code is here:
>> http://mspo.com/code/screenblankenv.c.txt
>>
>> Can anyone offer some hints? I'm a little stuck.
>
> autoconf(9) can be confusing at times. And the fact that the example
> code is wrong doesn't help.
>
> If you read http://www.netbsd.org/docs/kernel/pseudo/#functions, you'll
> notice that the <pseudo>attach function only takes one argument, which
> is an int (the number given in the config file, which defaults to 1).
>
> There is no softc involved for pseudo-devices (although if you use
> defpseudodev to declare it, you get the possibility to make that happen,
> but even then there is more work to do; it doesn't seem to me this is
> what you want though).
>
> So because <pseudo>attach is called with no device context, you have to
> do all memory allocations by yourself. I'll fix the example.
>
Thanks! I was really suspicious of an allocation problem but I didn't
see any other devices doing mallocs so I wasn't that confident. I'll
look forward to seeing the fixed example. :)
Home |
Main Index |
Thread Index |
Old Index