query regarding kernel daemon

Daniel Baluta daniel.baluta at gmail.com
Mon Apr 4 05:45:20 EDT 2011

> A daemon sleeps in the background. User can enter a string through the proc
> interface. Whenever a string is entered, the daemon is woke. The daemon
> keeps a copy of the last entered string in a variable. Initially the
> variable is initialized to NULL. When the daemon wakes, it checks if the
> string entered is same as the previous one or a new string is entered. When
> the string is entered, in case the new or the old strings are NULL, or in
> case the entered string is same as the old string the daemon goes back to
> sleep (with the help of the function interruptible_sleep_on().

Don't use interruptible_sleep_on use wait_event* instead.


[1] http://lxr.linux.no/linux+v2.6.38/include/linux/wait.h#L570

More information about the Kernelnewbies mailing list