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

Re: How to access static variable in kernel



On Wed, 14 Aug 2002 14:27:59 +0530
Debarchan.Dash@lntinfotech.com wrote:

DDC> I want to send lets say 10 packets from transmitter to receiver.
DDC> My problem is in the kernel file ip.c I have defined one static int
DDC> counter count ..
DDC> I want the portion inside the if loop should execute only & only once
DDC> when I will start sending packets...
DDC> so when I start sending packets the printf will print count == 0 for
DDC> the 1st packet & for nect packets it will print 1,1,1 as its static.
DDC> 
DDC> now if I will stop my transmitter & again if I want to send same 10
DDC> packets, that time the value of count in the 1st packet itself shows
DDC> count = 1, so the portion inside the if loop will not get executed..

	I guess either a per-session count should do the trick or use this global
counter and re-initialize it to 0 whenever a new session is opened.

	I think the former is more clean (actually less dirty), but both will do
the trick.

Felipe
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/