On Tue, Nov 4, 2008 at 11:03 AM, Santosh <ssantosh@xxxxxxxxxx> wrote: > Mohamed Thalib .H wrote: >> >> On Tue, 2008-11-04 at 11:14 +0530, Santosh wrote: >>> >>> Manish Katiyar wrote: >>>> >>>> On Tue, Nov 4, 2008 at 9:48 AM, Santosh <ssantosh@xxxxxxxxxx> wrote: >>>>> >>>>> Mohamed Thalib .H wrote: >>>>>> >>>>>> Hi all, >>>>>> >>>>>> I have a doubt >>>>>> >>>>>> Whether the code that is inside the moudles init and exit >>>>>> function >>>>>> will >>>>>> be executed if the module is not compiled as module and it is compiled >>>>>> into the kernel image itself. >>>>>> >>>>>> >>>>> The module's init fucntion will be run even if it is compiled >>>>> statically into the kernel image. The exit function won't be run since >>>>> it >>>>> can't be unloaded from the memory. >>>>> >>>>> In case where the kernel is configured not to unload modules the >>>>> exit >>>>> function will never be run since the module never unloads. Once the >>>>> init >>>>> function is executed the function itself is discarded since it won't be >>>>> needed later. >>>> >>>> Correct........and that is the memory you see when you see your bootup >>>> messages. Something like >>>> >>>> "Freed 128K of memory ....." >>>> >>>> But I think for that you have to declare with __init or can it take >>>> this decision by default ??? >>> >>> Yes, I guess to be freed up we use __init macro. Can it do this by >>> default, I am not sure. >>>> >>>> Thanks - >>>> Manish >>> >> >>> From the above i understand that once the __init code is complete then >> >> it will be completely remove out of memory and it will be no longer >> avaliable .. >> >> am I correct. >> >> and what about the __exit will it be included in the compile time or >> not. >> >> if included will it be removed at the time of executing free_initmem() >> function. - i dont think so on seeing the code it looks like it frees >> only the __init section. so the __exit section should be excluded in the >> kernel compile time itself. >> >> correct me if i am wrong. >> > > The exit function will not be included if the kernel is configured not to > unload the modules. >What about if we want to do some book keeping/ cleanup while unloading linux itself ??? ( on reboot/shutdowns). I mean i dont understand why exit/cleanup function would not be required (even in the case of statically linked???) Regards Nauman > Thanks, > Santosh > > -- > To unsubscribe from this list: send an email with > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx > Please read the FAQ at http://kernelnewbies.org/FAQ > > -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ