diff -ruN kozos40/extintr.c kozos41/extintr.c --- kozos40/extintr.c Sun Feb 1 23:23:47 2009 +++ kozos41/extintr.c Thu Feb 26 22:57:59 2009 @@ -8,6 +8,8 @@ #include "extintr.h" #include "extsub.h" +#define USE_MESSAGE + #define BUFFER_SIZE 1024 int extintr_id; @@ -56,6 +58,8 @@ typedef int (*initfunc)(struct interrupts *intp); +static void extintr_handler(int signo); + static int timerreg_init() { int i; @@ -110,7 +114,11 @@ close(cnt_fildes[0]); /* 読み込み端 */ control_fd = cnt_fildes[1]; /* 書き込み端 */ +#ifdef USE_MESSAGE kz_setsig(SIGHUP); +#else + kz_sethandler(SIGHUP, extintr_handler); +#endif for (i = 0; i < EXTINTR_TIMER_NUM; i++) { trp = &timerreg[i]; @@ -196,6 +204,7 @@ old_n = n; +#ifdef USE_MESSAGE if (id) { intrpri_old = intrpri_current; intrpri_current = n; @@ -203,6 +212,13 @@ kx_send(extintr_id, 0, NULL); } } +#else + intrpri_old = intrpri_current; + intrpri_current = n; + if (intrpri_current > intrpri_old) { + extintr_handler(SIGHUP); + } +#endif return; } @@ -239,7 +255,11 @@ char c; size = read(intp->regs.timer->read_fd, &c, 1); if ((size >= 0) && intp->id) { +#ifdef USE_MESSAGE kz_send(intp->id, 0, NULL); +#else + kx_send(intp->id, 0, NULL); +#endif } return 0; } @@ -312,12 +332,24 @@ int size; char *buffer; +#ifdef USE_MESSAGE buffer = kz_kmalloc(BUFFER_SIZE); +#else + buffer = kx_kmalloc(BUFFER_SIZE); +#endif size = read(intp->regs.cons->read_fd, buffer, BUFFER_SIZE); if ((size >= 0) && intp->id) +#ifdef USE_MESSAGE kz_send(intp->id, size, buffer); +#else + kx_send(intp->id, size, buffer); +#endif else +#ifdef USE_MESSAGE kz_kmfree(buffer); +#else + kx_kmfree(buffer); +#endif return 0; } @@ -370,7 +402,7 @@ return 0; } -static void extintr_handler() +static void extintr_handler(int signo) { int i; struct interrupts *intp; @@ -380,6 +412,7 @@ continue; if (intp->checkintr(intp)) { intp->intr(intp); + break; } } return; @@ -396,7 +429,7 @@ if (!id) { /* 子プロセスからの割り込み通知 */ - extintr_handler(); + extintr_handler(SIGHUP); } else { intp = NULL; switch (p[0]) {