From: Jorrit Herder Date: Wed, 20 Jul 2005 15:28:05 +0000 (+0000) Subject: Kernel sends SIGKSTOP just before shutdown. Drivers do clean up and exit. X-Git-Tag: v3.1.0~583 X-Git-Url: http://zhaoyanbai.com/repos/doc/tz-art.htm?a=commitdiff_plain;h=d2d975246dbb26d5bb48ae32a8dc1b85a54f9429;p=minix.git Kernel sends SIGKSTOP just before shutdown. Drivers do clean up and exit. --- diff --git a/drivers/dpeth/dp.c b/drivers/dpeth/dp.c index 0f443be27..b84a1386f 100644 --- a/drivers/dpeth/dp.c +++ b/drivers/dpeth/dp.c @@ -49,6 +49,9 @@ ** +------------+---------+---------+---------------+ ** ** $Log$ +** Revision 1.3 2005/07/20 15:28:04 jnherder +** Kernel sends SIGKSTOP just before shutdown. Drivers do clean up and exit. +** ** Revision 1.2 2005/07/14 15:15:17 jnherder ** Renamed some system library functionality. ** @@ -604,16 +607,19 @@ PUBLIC int main(void) case DL_STOP: /* Stop device */ do_stop(&m); break; - case HARD_STOP: /* Shut down */ - for (rc = 0; rc < DE_PORT_NR; rc += 1) { + case SYS_EVENT: { + sigset_t sigset = m.NOTIFY_ARG; + if (sigismember(&sigset, SIGKSTOP)) { /* Shut down */ + for (rc = 0; rc < DE_PORT_NR; rc += 1) { if (de_table[rc].de_mode == DEM_ENABLED) { m.m_type = DL_STOP; m.DL_PORT = rc; do_stop(&m); } + } } - sys_exit(0); break; + } case HARD_INT: /* Interrupt from device */ for (dep = de_table; dep < &de_table[DE_PORT_NR]; dep += 1) { /* If device is enabled and interrupt pending */ diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index 5855354f7..63463488a 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -315,7 +315,11 @@ int main(void) fxp_check_ints(fp); } break; - case HARD_STOP: fxp_stop(); break; + case SYS_EVENT: { + sigset_t sigset = m.NOTIFY_ARG; + if (sigismember(&sigset, SIGKSTOP)) fxp_stop(); + break; + } case SYN_ALARM: fxp_expire_timers(); break; default: panic("FXP"," illegal message", m.m_type); diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index 9e86b7104..56fda570e 100755 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -327,9 +327,7 @@ void main(void) * the driver in some cases. * MINIX timeouts result in a SYN_ALARM message to the * driver and thus are handled where they should be - * handled. Interrupt()s are faked by setting m_type to - * HARD_INT in rl_watchdog_f when needed, so that this - * case falls through. + * handled. Locally, watchdog functions are used again. */ rl_watchdog_f(NULL); break; @@ -339,7 +337,11 @@ void main(void) check_int_events(); break ; case FKEY_PRESSED: rtl8139_dump(&m); break; - case HARD_STOP: rtl8139_stop(); break; + case SYS_EVENT: { + sigset_t sigset = m.NOTIFY_ARG; + if (sigismember(&sigset, SIGKSTOP)) rtl8139_stop(); + break; + } default: panic("rtl8139","illegal message", m.m_type); } @@ -1904,7 +1906,7 @@ int may_block; reply.DL_STAT = status | ((u32_t) err << 16); reply.DL_COUNT = rep->re_read_s; if (OK != (r = getuptime(&now))) - panic("dp8390","getuptime() failed:", r); + panic("rtl8139","getuptime() failed:", r); reply.DL_CLCK = now; r= send(rep->re_client, &reply); @@ -1915,8 +1917,10 @@ int may_block; return; } - if (r < 0) - panic("dp8390","send failed:", r); + if (r < 0) { + printf("RTL8139 tried sending to %d, type %d\n", rep->re_client, reply.m_type); + panic("rtl8139","send failed:", r); + } rep->re_read_s = 0; rep->re_flags &= ~(REF_PACK_SENT | REF_PACK_RECV); @@ -2345,7 +2349,7 @@ timer_t *tp; int i; re_t *rep; /* Use a synchronous alarm instead of a watchdog timer. */ - sys_syncalrm(SELF, HZ, 0); + sys_setalarm(SELF, HZ, 0); for (i= 0, rep = &re_table[0]; i