[BACK]Return to sys_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/sys_sig.c between version 1.36 and 1.37

version 1.36, 2011/11/18 03:34:13 version 1.37, 2012/02/19 21:06:57
Line 73  __KERNEL_RCSID(0, "$NetBSD$");
Line 73  __KERNEL_RCSID(0, "$NetBSD$");
 #include <sys/signalvar.h>  #include <sys/signalvar.h>
 #include <sys/proc.h>  #include <sys/proc.h>
 #include <sys/pool.h>  #include <sys/pool.h>
 #include <sys/sa.h>  
 #include <sys/savar.h>  
 #include <sys/syscallargs.h>  #include <sys/syscallargs.h>
 #include <sys/kauth.h>  #include <sys/kauth.h>
 #include <sys/wait.h>  #include <sys/wait.h>
Line 553  out:
Line 551  out:
 int  int
 sigprocmask1(struct lwp *l, int how, const sigset_t *nss, sigset_t *oss)  sigprocmask1(struct lwp *l, int how, const sigset_t *nss, sigset_t *oss)
 {  {
         int more;          sigset_t *mask = &l->l_sigmask;
         struct proc *p = l->l_proc;          bool more;
         sigset_t *mask;  
         mask = (p->p_sa != NULL) ? &p->p_sa->sa_sigmask : &l->l_sigmask;  
   
         KASSERT(mutex_owned(p->p_lock));          KASSERT(mutex_owned(l->l_proc->p_lock));
   
         if (oss)          if (oss) {
                 *oss = *mask;                  *oss = *mask;
         if (nss) {  
                 switch (how) {  
                 case SIG_BLOCK:  
                         sigplusset(nss, mask);  
                         more = 0;  
                         break;  
                 case SIG_UNBLOCK:  
                         sigminusset(nss, mask);  
                         more = 1;  
                         break;  
                 case SIG_SETMASK:  
                         *mask = *nss;  
                         more = 1;  
                         break;  
                 default:  
                         return (EINVAL);  
                 }  
                 sigminusset(&sigcantmask, mask);  
                 if (more && sigispending(l, 0)) {  
                         /*  
                          * Check for pending signals on return to user.  
                          */  
                         lwp_lock(l);  
                         l->l_flag |= LW_PENDSIG;  
                         lwp_unlock(l);  
                 }  
         }          }
   
           if (nss == NULL) {
                   return 0;
           }
   
           switch (how) {
           case SIG_BLOCK:
                   sigplusset(nss, mask);
                   more = false;
                   break;
           case SIG_UNBLOCK:
                   sigminusset(nss, mask);
                   more = true;
                   break;
           case SIG_SETMASK:
                   *mask = *nss;
                   more = true;
                   break;
           default:
                   return EINVAL;
           }
           sigminusset(&sigcantmask, mask);
           if (more && sigispending(l, 0)) {
                   /*
                    * Check for pending signals on return to user.
                    */
                   lwp_lock(l);
                   l->l_flag |= LW_PENDSIG;
                   lwp_unlock(l);
           }
         return 0;          return 0;
 }  }
   
Line 749  sigtimedwait1(struct lwp *l, const struc
Line 748  sigtimedwait1(struct lwp *l, const struc
   
         mutex_enter(p->p_lock);          mutex_enter(p->p_lock);
   
         /* SA processes can have no more than 1 sigwaiter. */  
         if ((p->p_sflag & PS_SA) != 0 && !LIST_EMPTY(&p->p_sigwaiters)) {  
                 mutex_exit(p->p_lock);  
                 error = EINVAL;  
                 goto out;  
         }  
   
         /* Check for pending signals in the process, if no - then in LWP. */          /* Check for pending signals in the process, if no - then in LWP. */
         if ((signum = sigget(&p->p_sigpend, &ksi, 0, &l->l_sigwaitset)) == 0)          if ((signum = sigget(&p->p_sigpend, &ksi, 0, &l->l_sigwaitset)) == 0)
                 signum = sigget(&l->l_sigpend, &ksi, 0, &l->l_sigwaitset);                  signum = sigget(&l->l_sigpend, &ksi, 0, &l->l_sigwaitset);

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37

CVSweb <webmaster@jp.NetBSD.org>