/* * File : hello_mod.c * a simple module example * date : 2005.4.25 */ #include <linux/kernel.h>; #include <linux/module.h>; #if CONFIG_MODVERSIONS==1 //#define MODVERSIONS #include <linux/modversions.h>; #endif int init_module() { printk("hello world\n"); printk("i have running in kernel module\n"); return 1; } int clearup_module() { printk("i will shut down myself in kernel module\n...
by NewCore - 内核/嵌入技术 - 2005-04-29 09:03:49 阅读(647) 回复(9)
平台 redhat 8.0 内核 2.4.18-14 [code] /* hello.c */ /* The necessary header files */ /* Standard in kernel modules */ #include <linux/kernel.h>; /* We're doing kernel work */ #include <linux/module.h>; /* Specifically, a module */ /* Deal with CONFIG_MODVERSIONS */ #if CONFIG_MODVERSIONS==1 #define MODVERSIONS #include <linux/modversions.h>; #endif /* Initialize the module */ int...
初学linux Kernel Module Programming 编写了一个最简单的程序之后, 在使用insmod hello-1.o安装模块的时候, 出现了下面的错误警告信息: ./hello-1.o: kernel-module version mismatch ./hello-1.o was compiled for kernel version 2.4.20 while this kernel is version 2.4.20-8. 曾经有人指点我要修改 /usr/src/linux-2.4/Makefile 这个文件, 去掉 EXTRAVERSION = -8custom 这一行,然后重新 make dep 就可以了...
我有一个module,在写数据时要判断介质是否已满。如果已满,需要通知用户空间的一个进程(daemon)做一些事情。通知的迟延越小越好。请问有哪些机制能做到啊?signal可以吗? 很急!多谢知道的大哥指点!
代码如下。
我的疑惑是:为什么父进程不sleep 60秒,而是随着子进程的结束而结束了?难道是处理SIGCHDL信号导致sleep(60)调用提前结束了吗?
[code]
#include
我按书上的方法做了,但不行呀,谁指点一下啊? #make menuconfig 将需要用的选项,选中为M #make modules 最终结果说未有什么modules发生改变 #make modules_install 报错make:***[_modinst_post] Error 1 #/sbin/modprobe 哪位DX给点意见啊???
我现在要先创建一个文件,然后以追加的方式向这个文件中写入数据.我的想法是先创建这个文件,然后再以fopen(文件名,"a")的方式写入.但是我不知道在C中用一个函数如何创建一个文件; 由于考虑到性能问题,不想用 1.fopen(文件名,"w")的方式创建,这样要重复打开关闭一个文件指针; 2.system("dd ...."),这样要重新开辟一个子进程;