Sophie

Sophie

distrib > Mandriva > 9.0 > i586 > by-pkgid > 98e91bc877e03cf3582cd163550eb7e3 > files > 587

kernel-doc-html-2.4.19-16mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML
><HEAD
><TITLE
>__initcall()/module_init()
    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="__init/__exit/__initdata
    include/linux/init.h"
HREF="x277.html"><LINK
REL="NEXT"
TITLE=" module_exit()
    include/linux/init.h "
HREF="x305.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="x277.html"
ACCESSKEY="P"
>&#60;&#60;&#60; Previous</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Common Routines</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x305.html"
ACCESSKEY="N"
>Next &#62;&#62;&#62;</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="ROUTINES-INIT-AGAIN"
></A
><TT
CLASS="FUNCTION"
>__initcall()</TT
>/<TT
CLASS="FUNCTION"
>module_init()</TT
>
    <TT
CLASS="FILENAME"
>include/linux/init.h</TT
></H1
><P
>    Many parts of the kernel are well served as a module
    (dynamically-loadable parts of the kernel).  Using the
    <TT
CLASS="FUNCTION"
>module_init()</TT
> and
    <TT
CLASS="FUNCTION"
>module_exit()</TT
> macros it is easy to write code
    without #ifdefs which can operate both as a module or built into
    the kernel.
   </P
><P
>    The <TT
CLASS="FUNCTION"
>module_init()</TT
> macro defines which
    function is to be called at module insertion time (if the file is
    compiled as a module), or at boot time: if the file is not
    compiled as a module the <TT
CLASS="FUNCTION"
>module_init()</TT
> macro
    becomes equivalent to <TT
CLASS="FUNCTION"
>__initcall()</TT
>, which
    through linker magic ensures that the function is called on boot.
   </P
><P
>    The function can return a negative error number to cause
    module loading to fail (unfortunately, this has no effect if
    the module is compiled into the kernel).  For modules, this is
    called in user context, with interrupts enabled, and the
    kernel lock held, so it can sleep.
   </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="x277.html"
ACCESSKEY="P"
>&#60;&#60;&#60; 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="x305.html"
ACCESSKEY="N"
>Next &#62;&#62;&#62;</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><SPAN
CLASS="TYPE"
>__init</SPAN
>/<SPAN
CLASS="TYPE"
>__exit</SPAN
>/<SPAN
CLASS="TYPE"
>__initdata</SPAN
>
    <TT
CLASS="FILENAME"
>include/linux/init.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"
>module_exit()</TT
>
    <TT
CLASS="FILENAME"
>include/linux/init.h</TT
></TD
></TR
></TABLE
></DIV
></BODY
></HTML
>