Messages in this thread | ![/](/images/icornerl.gif) | | Date | Tue, 21 Mar 2000 00:19:11 +0100 | From | Richard Zidlicky <> | Subject | Re: timer causes kernel crash |
| |
On Mon, Mar 20, 2000 at 06:07:02AM -0500, Badrinath Venkatachari wrote: > Hi, > I have a function fn1() in the kernel that does some processing. But as > soon as I load a particular module, I want fn1() to start a timer > (declared as struct timer_list) for a function fn2() that simply printk's > messages and then continue with its normal processing.... (code enclosed > below) > > Everytime I load the module, the kernel crashes after printing the > message "Timer Added" and gives a stack trace. Can anyone explain why this > is happening ?? > > thanks in advance > > regards > badri > > ------------ code starts here (somefile.c)---------------- > > > /* exported to the loadable module and called in the LKM's > init_module() to set the flag so that the next time fn1() is called it > starts a timer for fn2() */ > > void setFlag() > { > flag_set = 1; > } > > void fn2() > { > re-initializes the timer to call itself... > printk("I am running !!!\n"); > } > > void fn1(args) > { > if (flag_set) > { > struct timer_list tl; ^^^^^^^^^^^^^^^
did you perhaps mean "static" ?
> init_timer(&tl); > tl.function = fn2; > tl.expires = RUN_AT(5*HZ); > tl.data = 0L; > add_timer(&tl); > printk("Timer added\n"); > } > normal_processing(); > }
Bye Richard
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |