hello.c

来自「李亚锋出的书《ARM嵌入式LINUX设备驱动实例开发》一书的码源!」· C语言 代码 · 共 33 行

C
33
字号
/*
 * File Name: hello.c
 *
 * Descriptions: 
 *		The simple example of kernel module code.
 *
 * Author: 
 *		Mike Lee
 * Kernel Version: 2.6.20
 *
 * Update:
 * 		-	2007.07.13	Mike Lee	 Creat this file
 */

#include <linux/init.h>
#include <linux/module.h>

MODULE_LICENSE("Dual BSD/GPL");
char *who="world";

static int hello_init(void)
{
        printk(KERN_ALERT "Hello, %s!\n", who);
        return 0;
}

static void hello_exit(void)
{
        printk(KERN_ALERT "Goodbye, %s!\n",who);
}

module_init(hello_init);
module_exit(hello_exit);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?