[BACK]Return to kern_sig.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / kern

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/kern/kern_sig.c between version 1.143 and 1.144

version 1.143, 2003/06/29 22:31:22 version 1.144, 2003/07/17 18:16:58
Line 528  sigsuspend1(struct proc *p, const sigset
Line 528  sigsuspend1(struct proc *p, const sigset
                 (void) spl0();          /* XXXSMP */                  (void) spl0();          /* XXXSMP */
         }          }
   
   
   
         while (tsleep((caddr_t) ps, PPAUSE|PCATCH, "pause", 0) == 0)          while (tsleep((caddr_t) ps, PPAUSE|PCATCH, "pause", 0) == 0)
                 /* void */;                  ;       /* void  */
   
         /* always return EINTR rather than ERESTART... */          /* always return EINTR rather than ERESTART... */
         return (EINTR);          return (EINTR);
 }  }
Line 867  psignal1(struct proc *p, int signum,
Line 870  psignal1(struct proc *p, int signum,
          */           */
         if ((prop & SA_CANTMASK) == 0          if ((prop & SA_CANTMASK) == 0
             && p->p_sigctx.ps_sigwaited < 0              && p->p_sigctx.ps_sigwaited < 0
             && sigismember(&p->p_sigctx.ps_sigwait, signum)) {              && sigismember(&p->p_sigctx.ps_sigwait, signum)
               &&  p->p_stat != SSTOP) {
                 sigdelset(&p->p_sigctx.ps_siglist, signum);                  sigdelset(&p->p_sigctx.ps_siglist, signum);
                 p->p_sigctx.ps_sigwaited = signum;                  p->p_sigctx.ps_sigwaited = signum;
                 sigemptyset(&p->p_sigctx.ps_sigwait);                  sigemptyset(&p->p_sigctx.ps_sigwait);
Line 889  psignal1(struct proc *p, int signum,
Line 893  psignal1(struct proc *p, int signum,
         if (dolock)          if (dolock)
                 SCHED_LOCK(s);                  SCHED_LOCK(s);
   
         if (p->p_nrlwps > 0) {          /* XXXUPSXXX LWPs might go to sleep without passing signal handling */
           if (p->p_nrlwps > 0 && (p->p_stat != SSTOP)) {
                 /*                  /*
                  * At least one LWP is running or on a run queue.                   * At least one LWP is running or on a run queue.
                  * The signal will be noticed when one of them returns                   * The signal will be noticed when one of them returns
Line 903  psignal1(struct proc *p, int signum,
Line 908  psignal1(struct proc *p, int signum,
         } else {          } else {
                 /* Process is sleeping or stopped */                  /* Process is sleeping or stopped */
                 if (p->p_flag & P_SA) {                  if (p->p_flag & P_SA) {
                         l = p->p_sa->sa_idle;                          struct lwp *l2 = p->p_sa->sa_vp;
                           l = NULL;
                           allsusp = 1;
   
                           if ((l2->l_stat == LSSLEEP) &&  (l2->l_flag & L_SINTR))
                                   l = l2;
                           else if (l2->l_stat == LSSUSPENDED)
                                   suspended = l2;
                           else if ((l2->l_stat != LSZOMB) &&
                                    (l2->l_stat != LSDEAD))
                                   allsusp = 0;
                 } else {                  } else {
                         /*                          /*
                          * Find out if any of the sleeps are interruptable,                           * Find out if any of the sleeps are interruptable,
Line 938  psignal1(struct proc *p, int signum,
Line 953  psignal1(struct proc *p, int signum,
                                 goto out;                                  goto out;
                         }                          }
   
   
                         /*                          /*
                          * When a sleeping process receives a stop                           * When a sleeping process receives a stop
                          * signal, process immediately if possible.                           * signal, process immediately if possible.
Line 962  psignal1(struct proc *p, int signum,
Line 978  psignal1(struct proc *p, int signum,
                                 goto out;                                  goto out;
                         }                          }
   
   
                         if (l == NULL) {                          if (l == NULL) {
                                 /*                                  /*
                                  * Special case: SIGKILL of a process                                   * Special case: SIGKILL of a process
Line 1059  psignal1(struct proc *p, int signum,
Line 1076  psignal1(struct proc *p, int signum,
         if (l->l_priority > PUSER)          if (l->l_priority > PUSER)
                 l->l_priority = PUSER;                  l->l_priority = PUSER;
  run:   run:
   
         setrunnable(l);         /* XXXSMP: recurse? */          setrunnable(l);         /* XXXSMP: recurse? */
  out:   out:
         /* XXXSMP: works, but icky */          /* XXXSMP: works, but icky */
Line 1074  psendsig(struct lwp *l, int sig, sigset_
Line 1092  psendsig(struct lwp *l, int sig, sigset_
         siginfo_t *si;          siginfo_t *si;
   
         if (p->p_flag & P_SA) {          if (p->p_flag & P_SA) {
   
                   /* XXXUPSXXX What if not on sa_vp ? */
   
                   int s = l->l_flag & L_SA;
                   l->l_flag &= ~L_SA;
                 si = pool_get(&siginfo_pool, PR_WAITOK);                  si = pool_get(&siginfo_pool, PR_WAITOK);
                 si->si_signo = sig;                  si->si_signo = sig;
                 si->si_errno = 0;                  si->si_errno = 0;
Line 1086  psendsig(struct lwp *l, int sig, sigset_
Line 1109  psendsig(struct lwp *l, int sig, sigset_
   
                 sa_upcall(l, SA_UPCALL_SIGNAL | SA_UPCALL_DEFER, le, li,                  sa_upcall(l, SA_UPCALL_SIGNAL | SA_UPCALL_DEFER, le, li,
                             sizeof(siginfo_t), si);                              sizeof(siginfo_t), si);
   
   
                   l->l_flag |= s;
                 return;                  return;
         }          }
   
Line 1140  issignal(struct lwp *l)
Line 1166  issignal(struct lwp *l)
         int             dolock = (l->l_flag & L_SINTR) == 0, locked = !dolock;          int             dolock = (l->l_flag & L_SINTR) == 0, locked = !dolock;
         sigset_t        ss;          sigset_t        ss;
   
   
           if (l->l_flag & L_SA) {
                   struct sadata *sa = p->p_sa;
   
                   /* Bail out if we do not own the virtual processor */
                   if (sa->sa_vp != l)
                           return 0;
           }
   
   
         if (p->p_stat == SSTOP) {          if (p->p_stat == SSTOP) {
                 /*                  /*
                  * The process is stopped/stopping. Stop ourselves now that                   * The process is stopped/stopping. Stop ourselves now that
Line 1322  proc_stop(struct proc *p)
Line 1358  proc_stop(struct proc *p)
   
         SCHED_ASSERT_LOCKED();          SCHED_ASSERT_LOCKED();
   
   
   
         /* XXX lock process LWP state */          /* XXX lock process LWP state */
         p->p_stat = SSTOP;          p->p_stat = SSTOP;
         p->p_flag &= ~P_WAITED;          p->p_flag &= ~P_WAITED;
Line 1333  proc_stop(struct proc *p)
Line 1371  proc_stop(struct proc *p)
          */           */
   
         LIST_FOREACH(l, &p->p_lwps, l_sibling) {          LIST_FOREACH(l, &p->p_lwps, l_sibling) {
                 if (l->l_stat == LSONPROC) {                  if ((l->l_stat == LSONPROC) && (l == curlwp)) {
                         /* XXX SMP this assumes that a LWP that is LSONPROC                          /* XXX SMP this assumes that a LWP that is LSONPROC
                          * is curlwp and hence is about to be mi_switched                           * is curlwp and hence is about to be mi_switched
                          * away; the only callers of proc_stop() are:                           * away; the only callers of proc_stop() are:
Line 1346  proc_stop(struct proc *p)
Line 1384  proc_stop(struct proc *p)
                          */                           */
                         l->l_stat = LSSTOP;                          l->l_stat = LSSTOP;
                         p->p_nrlwps--;                          p->p_nrlwps--;
                 } else if (l->l_stat == LSRUN) {                  }
                    else if ( (l->l_stat == LSSLEEP) && (l->l_flag & L_SINTR)) {
                           setrunnable(l);
                   }
   
   /* !!!UPS!!! FIX ME */
   #if 0
   else if (l->l_stat == LSRUN) {
                         /* Remove LWP from the run queue */                          /* Remove LWP from the run queue */
                         remrunqueue(l);                          remrunqueue(l);
                         l->l_stat = LSSTOP;                          l->l_stat = LSSTOP;
Line 1374  proc_stop(struct proc *p)
Line 1419  proc_stop(struct proc *p)
                             p->p_pid, l->l_lid, l->l_stat);                              p->p_pid, l->l_lid, l->l_stat);
                 }                  }
 #endif  #endif
   #endif
         }          }
         /* XXX unlock process LWP state */          /* XXX unlock process LWP state */
   
   
         sched_wakeup((caddr_t)p->p_pptr);          sched_wakeup((caddr_t)p->p_pptr);
 }  }
   
Line 1584  lwp_coredump_hook(struct lwp *l, void *a
Line 1631  lwp_coredump_hook(struct lwp *l, void *a
 void  void
 sigexit(struct lwp *l, int signum)  sigexit(struct lwp *l, int signum)
 {  {
   
         struct proc     *p;          struct proc     *p;
   #if 0
         struct lwp      *l2;          struct lwp      *l2;
   #endif
         int             error, exitsig;          int             error, exitsig;
   
         p = l->l_proc;          p = l->l_proc;
Line 1601  sigexit(struct lwp *l, int signum)
Line 1651  sigexit(struct lwp *l, int signum)
         p->p_flag |= P_WEXIT;          p->p_flag |= P_WEXIT;
         /* We don't want to switch away from exiting. */          /* We don't want to switch away from exiting. */
         /* XXX multiprocessor: stop LWPs on other processors. */          /* XXX multiprocessor: stop LWPs on other processors. */
   #if 0
         if (p->p_flag & P_SA) {          if (p->p_flag & P_SA) {
                 LIST_FOREACH(l2, &p->p_lwps, l_sibling)                  LIST_FOREACH(l2, &p->p_lwps, l_sibling)
                     l2->l_flag &= ~L_SA;                      l2->l_flag &= ~L_SA;
                 p->p_flag &= ~P_SA;                  p->p_flag &= ~P_SA;
         }          }
   #endif
   
         /* Make other LWPs stick around long enough to be dumped */          /* Make other LWPs stick around long enough to be dumped */
         p->p_userret = lwp_coredump_hook;          p->p_userret = lwp_coredump_hook;

Legend:
Removed from v.1.143  
changed lines
  Added in v.1.144

CVSweb <webmaster@jp.NetBSD.org>