実際にシグナルを発生させるために、割り込みハンドラ
(dio_interrupt_handlerの中にkill_fasync関数を追加する。
(次ページ参照)
void dio_interrupt_handler(int irq, void *dev_id, struct pt_regs *regs)
{
unsigned char status;
PDIO_RESOURCE pdio_res = (PDIO_RESOURCE)dev_id;
if (pdio_res == NULL)
return;
// [interrupt status] wo Kakunin
status = inb(pdio_res->io_address[0] + 0x0C);
if (status == 0)
return;
// [interrupt status] wo [clear] suru
outb(status, pdio_res->io_address[0] + 0x0C);
// [signal] wo Okuru
if (pdio_res->fasync)
kill_fasync(&pdio_res->fasync, SIGIO, POLL_IN);
// printk("INTERRUPT\n");
// Warikomi no ShikiBetsu
if (status & 0x01)
printk("SIG1 INTERRUPT\n");
else if (status & 0x02)
printk("SIG2 INTERRUPT\n");
else if (status & 0x04)
printk("SIG3 INTERRUPT\n");
else if (status & 0x08)
printk("SIG4 INTERRUPT\n");
else if (status & 0x10)
printk("TIMER INTERRUPT\n");
else if (status & 0x20)
printk("RSTIN INTERRUPT\n");
}
ここで、先ほどDIO_RES構造体に追加したdio_fasyncへのポイン
タを使用して、SIGIOシグナルを送信している。(送信先は
F_SETOWNで指定したプロセスである。)