???????????????????????飬???????У?????????????????????????ID???????3278????????????????????????????????kill????????????????????SIGTERM???????????????????????/var/log/messages??????????????????

????????????????????????λ??????0?????????????????????????п???????????signal_pending()????????true??????£???????????????????????????е???????????????????????????my_sigpending()???ú???????sys_sigpending()?????????????

?????????????sys_sigpending()??????в??????

??????sys_sigpending()?????????do_sigpending()??????????????????do_sigpending()???????do_sigpending()??????£?

long do_sigpending(void __user *set?? unsigned long sigsetsize)
{
 long error = -EINVAL;
 sigset_t pending;

 if (sigsetsize > sizeof(sigset_t))
  goto out;

 spin_lock_irq(&current->sighand->siglock);
 sigorsets(&pending?? &current->pending.signal??
    &current->signal->shared_pending.signal);
 spin_unlock_irq(&current->sighand->siglock);

 /* Outside the lock because only this thread touches it.  */
 sigandsets(&pending?? &current->blocked?? &pending);

 error = -EFAULT;
 if (!copy_to_user(set?? &pending?? sigsetsize))
  error = 0;

out:
 return error;
}

????do_sigpending()???????sigorsets()??????????????????current->pending.signal??current->signal->shared_pending.signal?????л?????????????????????????????????????洢?????????pending?С???????????????????????????????????????sigandsets()??pending??????????????????????????????????????

????????????????????????sigandsets()??pending?????current->blocked?????????do_sigpending()?????thread_process()???????????????????????λ???????????????thread_process()?????????????

static int thread_process(void *arg)
{
    sigset_t *sigset?? __sigset;
  
    sigset = &__sigset;
  
    allow_signal(SIGURG);
    allow_signal(SIGTERM);
    allow_signal(SIGKILL);
    allow_signal(SIGSTOP);
    allow_signal(SIGCONT);
  
    printk(KERN_ALERT "the pid of thread_process is %d. "?? current->pid);
  
    spin_lock_irq(&current->sighand->siglock);
    sigorsets(sigset?? &current->pending.signal??
        &current->signal->shared_pending.signal);
    spin_unlock_irq(&current->sighand->siglock<SPAN style="FONT-FAMILY: Arial?? Helvetica?? sans-serif">);</SPAN>
 
    printk(KERN_ALERT "Before receive signal?? signal map: 0x%lX. "?? sigset->sig[0]);
    printk(KERN_ALERT "Beofore receive signal?? blocked map: 0x%lX. "?? current->blocked.sig[0]);
  
    for ( ; !remove_mod; ) {
        /* Avoid infinite loop */
        msleep(1000);
        if (signal_pending(current)) {
            spin_lock_irq(&current->sighand->siglock);
         sigorsets(sigset?? &current->pending.signal??
          &current->signal->shared_pending.signal);
         spin_unlock_irq(&current->sighand->siglock);
            printk(KERN_ALERT "Received signal?? signal map: 0x%lX. "?? sigset->sig[0]);
          
            printk(KERN_ALERT "Receive SIGURG signal ? %s. "??
                sigismember(sigset?? SIGURG) ? "true" : "false");
            printk(KERN_ALERT "Receive SIGTERM signal ? %s. "??
                sigismember(sigset?? SIGTERM) ? "true" : "false");
            printk(KERN_ALERT "Receive SIGKILL signal ? %s. "??
                sigismember(sigset?? SIGKILL) ? "true" : "false");
            printk(KERN_ALERT "Receive SIGSTOP signal ? %s. "??
                sigismember(sigset?? SIGSTOP) ? "true" : "false");
            /* Use halt to stop the system */
            printk(KERN_ALERT "Receive SIGCONT signal ? %s. "??
                sigismember(sigset?? SIGCONT) ? "true" : "false");
            break;
        }
    }
    return 0;
}