- 论坛徽章:
- 0
|
irqreturn_t short_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
struct timeval tv;
int written;
do_gettimeofday(&tv);
written = sprintf((char *)short_head,"%08u.%06u\n",(int)(tv.tv_sec % 100000000), (int)(tv.tv_usec)); //这个不是有可能越界吗,为什么还这样用啊,
short_incr_bp(&short_head, written);
wake_up_interruptible(&short_queue); /* awake any reading process */
return IRQ_HANDLED;
}
整个程序我没有运行起来,只是看看,
自己实验的:
unsigned long short_buffer = 0;
int short_init(void)
{
int i=0;
short_buffer = __get_free_pages(GFP_KERNEL,0);
i=sprintf((char*)short_buffer+1024*1024*1024,"%d",1); //出问题了
printk("init----------end:%d\n",i);
return 0;
} |
|