Q: Loadable kernel module trouble with sleep() function call in RedHat I am facing an issue in trying to load an LKM into the RedHat kernel using insmod, but it returns me the following error:-

Insmod –f tmdq.o
tmdq.o: unresolved symbol sleep

Why should sleep() system call from within the LKM cause an issue? I wish to check if there is some other name given to sleep() in the Red Hat Linux 3.2.2-5, Linux version 2.4.20-8.
Also, is there a way to browse  the source code of RedHat online, without having to download it?
Thanks.

A: First, sleep() is not as system call, it is implemented in libc by using sys_nanosleep syscall.
So there is no sleep in kernel, use msleep, mdelay or usleep_range (include/linux/delay.h) or maybe one of wait_event_ functions (include/linux/wait.h)

A: Definitions of msleep and other variants are not included in the kernel 2.4.20. One will have to implement it on his own using schedule_timeout() function of the kernel.
Additionally, this is where one can browse kernel code: lxr.linux.no
