<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <HTML ><HEAD ><TITLE >__init/__exit/__initdata include/linux/init.h</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Unreliable Guide To Hacking The Linux Kernel" HREF="book1.html"><LINK REL="UP" TITLE="Common Routines" HREF="c141.html"><LINK REL="PREVIOUS" TITLE="smp_processor_id()/cpu_[number/logical]_map() include/asm/smp.h" HREF="x266.html"><LINK REL="NEXT" TITLE="__initcall()/module_init() include/linux/init.h" HREF="x292.html"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Unreliable Guide To Hacking The Linux Kernel</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="x266.html" ACCESSKEY="P" ><<< Previous</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Common Routines</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="x292.html" ACCESSKEY="N" >Next >>></A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="ROUTINES-INIT" ></A ><SPAN CLASS="TYPE" >__init</SPAN >/<SPAN CLASS="TYPE" >__exit</SPAN >/<SPAN CLASS="TYPE" >__initdata</SPAN > <TT CLASS="FILENAME" >include/linux/init.h</TT ></H1 ><P > After boot, the kernel frees up a special section; functions marked with <SPAN CLASS="TYPE" >__init</SPAN > and data structures marked with <SPAN CLASS="TYPE" >__initdata</SPAN > are dropped after boot is complete (within modules this directive is currently ignored). <SPAN CLASS="TYPE" >__exit</SPAN > is used to declare a function which is only required on exit: the function will be dropped if this file is not compiled as a module. See the header file for use. Note that it makes no sense for a function marked with <SPAN CLASS="TYPE" >__init</SPAN > to be exported to modules with <TT CLASS="FUNCTION" >EXPORT_SYMBOL()</TT > - this will break. </P ><P > Static data structures marked as <SPAN CLASS="TYPE" >__initdata</SPAN > must be initialised (as opposed to ordinary static data which is zeroed BSS) and cannot be <SPAN CLASS="TYPE" >const</SPAN >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="x266.html" ACCESSKEY="P" ><<< Previous</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="book1.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="x292.html" ACCESSKEY="N" >Next >>></A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><TT CLASS="FUNCTION" >smp_processor_id</TT >()/<TT CLASS="FUNCTION" >cpu_[number/logical]_map()</TT > <TT CLASS="FILENAME" >include/asm/smp.h</TT ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="c141.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><TT CLASS="FUNCTION" >__initcall()</TT >/<TT CLASS="FUNCTION" >module_init()</TT > <TT CLASS="FILENAME" >include/linux/init.h</TT ></TD ></TR ></TABLE ></DIV ></BODY ></HTML >