> Hi, I was having a tour in the kernel sources and I found some codes
> that I can't understand why. Like this in ppp:
>
> int
> ppp_init (struct device *dev)
> {
> static int first_time = 1; <== define to 1
> int answer = 0;
>
> if (first_time) { <== check if is 1, why ? any special special reason?
> first_time = 0;
> answer = ppp_first_time();
> if (answer == 0)
> (void) register_symtab (&ppp_syms);
> }
> if (answer == 0)
> answer = -ENODEV;
> return answer;
> }
>
> I found many more codes like this in the source, I cant remeber where anymore.
>
first_time is "static". It is initialized to "true" once. Then, the
first time the code executes, it is set to "false". From that time on,
and ever forevermore, the "first_time" code will not be executed again.
Cheers,
Dick Johnson
Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : The end of the world as we know it requires a new calendar.
Seconds : 833552 (until Y2K)
-
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/