Linux????е???????????????
???????????? ???????[ 2013/2/16 10:27:07 ] ????????
??????ó?????????????????kill???С?????????“kill”??????????????SIGKILL?????ú????????????????????????sys_kill????????????????????????????
????????????????????id??kill()????????????????飩????????????????????????pid??????????????
?????? pid>0?????????????????????????pid?????
?????? pid=0?????????????????????е??????????
?????? pid=-1????????????κ?????????init?????PID=1???????????????????????????????
?????? pid<-1??????????????????飬??id??????е?pid????????
??????????????????????????
????????sys_kill??????????????????????????????????????????????????????????????????pid??????????????????С?tkill??????????sys_tkill??kernel/signal.c???????????£?
/*
* Send a signal to only one task?? even if it's a CLONE_THREAD task.
*/
asmlinkage long
sys_tkill(int pid?? int sig)
{
struct siginfo info;
int error;
struct task_struct *p;
/* This is only valid for single tasks */
if (pid <= 0)//?????pid???м??
return -EINVAL;
info.si_signo = sig; //???????????????siginfo??
info.si_errno = 0;
info.si_code = SI_TKILL;
info.si_pid = current->tgid;
info.si_uid = current->uid;
read_lock(&tasklist_lock);
p = find_task_by_pid(pid);//?????pid?????????task_struct??
error = -ESRCH;
if (p) {
error = check_kill_permission(sig?? &info?? p);//?????
/*
* The null signal is a permissions and process existence
* probe. No signal is actually delivered.
*/
if (!error && sig && p->sighand) {
spin_lock_irq(&p->sighand->siglock);
handle_stop_signal(sig?? p);
//???Щ?????????????????統(tǒng)???SIGSTOP???????????????е?SIGCONT??????
error = specific_send_sig_info(sig?? &info?? p);//??????????????
spin_unlock_irq(&p->sighand->siglock);
}
}
read_unlock(&tasklist_lock);
return error;
}
??????
???·???
??????????????????
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