???????л????????????
???????????? ???????[ 2013/2/1 10:17:45 ] ????????
???????????????????????飬???????У?????????????????????????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(¤t->sighand->siglock);
sigorsets(&pending?? ¤t->pending.signal??
¤t->signal->shared_pending.signal);
spin_unlock_irq(¤t->sighand->siglock);
/* Outside the lock because only this thread touches it. */
sigandsets(&pending?? ¤t->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(¤t->sighand->siglock);
sigorsets(sigset?? ¤t->pending.signal??
¤t->signal->shared_pending.signal);
spin_unlock_irq(¤t->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(¤t->sighand->siglock);
sigorsets(sigset?? ¤t->pending.signal??
¤t->signal->shared_pending.signal);
spin_unlock_irq(¤t->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;
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11