From: Ben Gras Date: Fri, 18 Jun 2010 13:54:30 +0000 (+0000) Subject: fixes r7363, r7356, r7352 from trunk X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=f4499bd4a011ee02ed0f167e4ae3a8b5f4c79ed8;p=minix.git fixes r7363, r7356, r7352 from trunk --- diff --git a/servers/pm/misc.c b/servers/pm/misc.c index 984200148..1fa22e3f8 100644 --- a/servers/pm/misc.c +++ b/servers/pm/misc.c @@ -79,6 +79,7 @@ PUBLIC int do_procstat() if (m_in.stat_nr == SELF) { mp->mp_reply.sig_set = mp->mp_sigpending; sigemptyset(&mp->mp_sigpending); + sigemptyset(&mp->mp_ksigpending); } else { return(ENOSYS); diff --git a/servers/pm/mproc.h b/servers/pm/mproc.h index 65cb183f7..81525e186 100644 --- a/servers/pm/mproc.h +++ b/servers/pm/mproc.h @@ -41,6 +41,7 @@ EXTERN struct mproc { sigset_t mp_sigmask; /* signals to be blocked */ sigset_t mp_sigmask2; /* saved copy of mp_sigmask */ sigset_t mp_sigpending; /* pending signals to be handled */ + sigset_t mp_ksigpending; /* bitmap for pending signals from the kernel */ sigset_t mp_sigtrace; /* signals to hand to tracer first */ struct sigaction mp_sigact[_NSIG]; /* as in sigaction(2) */ vir_bytes mp_sigreturn; /* address of C library __sigreturn function */ diff --git a/servers/pm/signal.c b/servers/pm/signal.c index be287d631..9d054fab7 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -67,6 +67,7 @@ PUBLIC int do_sigaction() if (svec.sa_handler == SIG_IGN) { sigaddset(&mp->mp_ignore, m_in.sig_nr); sigdelset(&mp->mp_sigpending, m_in.sig_nr); + sigdelset(&mp->mp_ksigpending, m_in.sig_nr); sigdelset(&mp->mp_catch, m_in.sig_nr); } else if (svec.sa_handler == SIG_DFL) { sigdelset(&mp->mp_ignore, m_in.sig_nr); @@ -347,6 +348,7 @@ int ksig; /* non-zero means signal comes from kernel */ if (rmp->mp_flags & FS_CALL) { sigaddset(&rmp->mp_sigpending, signo); + if(ksig) sigaddset(&rmp->mp_ksigpending, signo); if (!(rmp->mp_flags & PM_SIG_PENDING)) { /* No delay calls: FS_CALL implies the process called us. */ @@ -361,6 +363,11 @@ int ksig; /* non-zero means signal comes from kernel */ /* Handle system signals for system processes first. */ if(rmp->mp_flags & PRIV_PROC) { + /* Always skip signals for PM (only necessary when broadcasting). */ + if(rmp->mp_endpoint == PM_PROC_NR) { + return; + } + /* System signals have always to go through the kernel first to let it * pick the right signal manager. If PM is the assigned signal manager, * the signal will come back and will actually be processed. @@ -370,11 +377,6 @@ int ksig; /* non-zero means signal comes from kernel */ return; } - /* Always skip signals for PM (only necessary when broadcasting). */ - if(rmp->mp_endpoint == PM_PROC_NR) { - return; - } - /* Print stacktrace if necessary. */ if(SIGS_IS_STACKTRACE(signo)) { sys_sysctl_stacktrace(rmp->mp_endpoint); @@ -406,6 +408,7 @@ int ksig; /* non-zero means signal comes from kernel */ if (!badignore && sigismember(&rmp->mp_sigmask, signo)) { /* Signal should be blocked. */ sigaddset(&rmp->mp_sigpending, signo); + if(ksig) sigaddset(&rmp->mp_ksigpending, signo); return; } @@ -415,6 +418,7 @@ int ksig; /* non-zero means signal comes from kernel */ * will be delivered using the check_pending() calls in do_trace(). */ sigaddset(&rmp->mp_sigpending, signo); + if(ksig) sigaddset(&rmp->mp_ksigpending, signo); return; } if (!badignore && sigismember(&rmp->mp_catch, signo)) { @@ -428,6 +432,7 @@ int ksig; /* non-zero means signal comes from kernel */ if (!(rmp->mp_flags & UNPAUSED)) { /* not yet unpaused; continue later */ sigaddset(&rmp->mp_sigpending, signo); + if(ksig) sigaddset(&rmp->mp_ksigpending, signo); return; } @@ -564,12 +569,15 @@ register struct mproc *rmp; */ int i; + int ksig; for (i = 1; i < _NSIG; i++) { if (sigismember(&rmp->mp_sigpending, i) && !sigismember(&rmp->mp_sigmask, i)) { + ksig = sigismember(&rmp->mp_ksigpending, i); sigdelset(&rmp->mp_sigpending, i); - sig_proc(rmp, i, FALSE /*trace*/, FALSE /* ksig */); + sigdelset(&rmp->mp_ksigpending, i); + sig_proc(rmp, i, FALSE /*trace*/, ksig); if (rmp->mp_flags & FS_CALL) break; @@ -711,6 +719,7 @@ int signo; /* signal to send to process (1 to _NSIG-1) */ rmp->mp_sigact[signo].sa_handler = SIG_DFL; } sigdelset(&rmp->mp_sigpending, signo); + sigdelset(&rmp->mp_ksigpending, signo); if(vm_push_sig(rmp->mp_endpoint, &cur_sp) != OK) return(FALSE); diff --git a/servers/vm/region.c b/servers/vm/region.c index a4ac327ee..faf2bd08b 100644 --- a/servers/vm/region.c +++ b/servers/vm/region.c @@ -559,21 +559,6 @@ PUBLIC void pb_unreferenced(struct vir_region *region, struct phys_region *pr) panic("strange phys flags"); } SLABFREE(pb); - } else { - struct phys_region *others; - int n = 0; - - for(others = pb->firstregion; others; - others = others->next_ph_list) { - if(WRITABLE(region, others->ph)) { - if(map_ph_writept(others->parent->parent, - others->parent, others) != OK) { - printf("VM: map_ph_writept failed unexpectedly\n"); - } - } - n++; - } - assert(n == pb->refcount); } }