khello/khello.c
author Markus Bröker<broeker.markus@googlemail.com>
Fri, 20 Oct 2017 06:41:27 +0200
changeset 168 dfb60716880c
parent 77 49e0babccb23
permissions -rw-r--r--
Broken OSX Demo added
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
77
49e0babccb23 HEADER TAGS
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 50
diff changeset
     1
/**
49e0babccb23 HEADER TAGS
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 50
diff changeset
     2
 * khello/khello.c
49e0babccb23 HEADER TAGS
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 50
diff changeset
     3
 * hello-1.c - The simplest kernel module.
50
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     4
 */
77
49e0babccb23 HEADER TAGS
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 50
diff changeset
     5
50
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     6
#include <linux/module.h>       /* Needed by all modules */
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     7
#include <linux/kernel.h>       /* Needed for KERN_INFO */
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     8
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     9
int init_module (void)
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    10
{
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    11
    printk (KERN_INFO "Hello world 1.\n");
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    12
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    13
    /*
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    14
     * A non 0 return means init_module failed; module can't be loaded.
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    15
     */
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    16
    return 0;
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    17
}
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    18
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    19
void cleanup_module (void)
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    20
{
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    21
    printk (KERN_INFO "Goodbye world 1.\n");
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    22
}