Re: Some doubts (kernel daemons, interruptible_sleep_on etc)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 22, 2002 at 12:06:51AM -0800, Swapnil Nagle wrote:

> * Can anybody give pointers to coding kernel daemons..  It has to be in

I've pointed you to look at frey's page more than once on IRC.

> * Can a module sleep in its init_module function ?

yes, but only for short times.

you should create a kernel thread in init instead.

>             __init init_module { set kernel timer to expire in 1 sec }
> 
>             timeout_func { interruptible_sleep_on(&my_queue); }
> 
> After the timer expires, the kernel panics: Aiee..scheduling in interrupt

1) don't EVER use _sleep_on - prefer wait_event_interruptible()

2) timer callbacks are in interrupt context, you cannot sleep

It sounds like what you are doing is totally inappropriate for a module anyhoo

regards
john

-- 
"We didn't have metaphors in our day. We didn't beat around the bush."
	- Fred Trueman
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux