- 論壇徽章:
- 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)); //這個(gè)不是有可能越界嗎,為什么還這樣用啊,
short_incr_bp(&short_head, written);
wake_up_interruptible(&short_queue); /* awake any reading process */
return IRQ_HANDLED;
}
整個(gè)程序我沒有運(yùn)行起來,只是看看,
自己實(shí)驗(yàn)的:
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;
} |
|