[CentOS] kernel mod compilation frustration

Tue Jul 20 14:46:07 UTC 2010
m.roth at 5-cent.us <m.roth at 5-cent.us>

James Pearson wrote:
> m.roth at 5-cent.us wrote:
>> I want to add a sleep() to a module. It tells me it can't find <time.h>;
>> if I tell it "/usr/include/time.h", it gives me a ton of errors (I
>> *have*
>> put the #include just above where I call sleep, not up at the top).
>>
>> Any clues as to what I'm doing wrong? With kernel
>> /vmlinuz-2.6.18-194.3.1.el5, I just added the line
>> extern unsigned int sleep( unsigned int seconds );
>> and everything was wonderful; with the current kernel, it complains
>> sleep
>> is undefined.
>
> The kernel doesn't use include files from /usr/include - it uses its own
> from its own include directory
>
I did finally find that out, after I posted, and it makes sense, since
it's *got* to be statically linked.

> You probably want to use something like ssleep(), msleep() or mdelay() -
> see include/linux/delay.h and kernel/timer.c

I see, and thanks! I note there's no man page for any of them. Also, this
is, um, odd: going to 5.5, I started getting garbage in the logs for gspca
(for an old video camera; we have a number, for security, in our locked
server rooms); I added a sleep, as I mentioned, and it worked fine. Then
it stopped working... and with the latest kernel, suddenly, it works fine
again, *without* the sleep().

Dunno, dunno, some timing thing.

Again, thanks, and I *will* push that info onto the stack, to be popped
off when needed next.

          mark