Re: How to understand the macro __init?
|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]|
2012/8/16 Amarnath Revanna <amarnath.revanna@xxxxxxxxx>
Hi Vijay,Is this a loadable kernel module or a built-in module?If it is a loadable module, everything still remains in the memory without being freed.Functions and data defined with __init gets freed after their execution only if these are part of built-in kernel modules.In your case, if the module is a loadable one, you can still access the print_k() from hello_exit() as its still residing in memory.Regards,-AmarHi AmarThank you very much for reply. I often write loadable modules,but know little aboutbuilt-in modules,can you tell something about built-in modules? or,how i can take a built-inmodule into the kernel?
On Thu, Aug 16, 2012 at 5:23 PM, Vijay Chauhan <kernel.vijay@xxxxxxxxx> wrote:
Even if we call print_k() function inside hello_exit, it still works.
On Tue, Aug 14, 2012 at 9:34 AM, Mulyadi Santosa
> Hi.. :)
> On Tue, Aug 14, 2012 at 9:14 AM, 王哲 <wangzhe5004@xxxxxxxxx> wrote:
>> i use the __init for function print_k.
>> in my opinion after the fisrt invoking the print_k in the hello_init.
>> the memory of print_k will be freed,and the second invoking will
>> not be executed.but the result of second invoking is executing .
> because you're still in module_init.... :)
> right after modul init stage is done, _init marked function is thrown away...
At that point __init hello_init execution is over. How its still
> Mulyadi Santosa
> Freelance Linux trainer and consultant
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com
> Kernelnewbies mailing list
Kernelnewbies mailing list
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
[Newbies FAQ] [Linux Kernel Mentors] [Linux Kernel Development] [IETF Annouce] [Git] [Networking] [Security] [Bugtraq] [Photo] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Linux Networking] [Linux RAID] [Linux SCSI] [Linux ACPI]