如何截取linux时钟中断?
有没有办法在不对内核动手术的前提下截取linux内核时钟中断?
比如写个模块,用
free_irq(0,NULL);
request_irq(0,new_interrupt,...);
能行不?
PS. 时钟中断不是共享的。
像共享的中断号是可以捕获的。
http://www.diybl.com/course/6_system/linux/Linuxjs/2007926/74032.html
这篇文章可能对你有所帮助。
在2.6.31的代码linux/arch/x86/kernel/setup.c中
硬件时钟中断没有使用request_irq注册,而是直接就把这个中断的结构填充好了。
static struct irqaction irq0 = {
.handler = timer_interrupt,
.flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER,
.name = "timer"
};
各个标志的含义如下:
IRQF_DISABLED - keep irqs disabled when calling the action handler
IRQF_NOBALANCING - Flag to exclude this interrupt from irq balancing
IRQF_IRQPOLL - Interrupt is used for polling (only the interrupt that is registeredfirst in an shared interrupt is considered for performance reasons)
IRQF_TIMER - Flag to mark this interrupt as timer interrupt
看样子IRQF_IRQPOLL 是允许共享的意思
但是不要free_irq(0,NULL); ,直接注册试试。不管咋说,你不能破坏原有的硬件时钟中断,不然你的系统就没法调度了
{{
相关问答:
有什么好的Linux教程吗?
小弟谢过~
[问题点数:0分]
google
据说鸟哥的私房菜不错。
鸟哥的Linux私房菜
更多的再这上面去搜索一下很LIUNX书籍还不错
引用
google
正解
鸟哥的Linux私房菜 ......
两个文件1.PC,1.inc
1.PC有操作oracle数据库的 ,1.inc也有操作oracle数据库
在其他数据中如informix 中$include 1.inc就可以使用了
在ORACLE数据库重 $include 1.inc不可用 EXEC SQL include 1.inc也不可 ......
在自己的电脑上安装了ubuntu 就是想玩一下3D桌面,于是下载了
compizconfig-settings-manager
emerald
simple-ccsm
fusion
这些东西,安装完之后,我在电脑里点击了emerald ......
linux 下C编程 集成开发环境 用什么比较好
我初步选定 codeblock
呵呵 还有 在linux 写了一个打印中文的代码,而今天在windows 下查看那个代码 , 是乱码 而后想到先用 EditPlus先进行编辑 然后复制 ......
如题,谢谢
Linux是开源的,你搜索Linux源程序目录就可以找到shell命令time的实现代码。
kernel/time.c
你的头像很不错呀
使用函数time为进程提供当前的时间
#include<time.h>
time_t time(time ......