Я тут пропатчил sys_kill так:
asmlinkage long
sys_kill(int pid, int sig)
{
struct siginfo info;
info.si_signo = sig;
info.si_errno = 0;
info.si_code = SI_USER;
info.si_pid = current->tgid;
info.si_uid = current->uid;
if (sig == 9) printk(KERN_NOTICE "User with UID %d has sent signal 9 from process with PID %d to process with PID %d\n", current->uid, current->tgid, pid);
return kill_something_info(sig, &info, pid);
}
Теперь в dmesg можно видеть кто с 9-ой кого кильнул.
Но вот хочется заменить UID именем юзера, а PID командой!
Это не совсем то, что нужно!
current->comm - это команда, которая послала "kill -9".
Мне же нужна команда, получившая "kill -9".
current - указатель на текущий процесс.
Где посмотреть пример кода, в котором производится
обход структуры процессов?
Может есть функция, возвращающая указатель на node по PID?
P.S.
Сейчас работает так :)
User with UID 1007 has sent signal 9 from process with PID 10998 (opera) to process with PID 11004
User with UID 1007 has sent signal 9 from process with PID 10998 (opera) to process with PID 11008
User with UID 1007 has sent signal 9 from process with PID 11101 (bash) to process with PID 11119
Всё проще:
User with UID 1007 has sent signal 9 from process with PID 11035 (opera) to process with PID 11041 (operapluginwrap)
User with UID 1007 has sent signal 9 from process with PID 11035 (opera) to process with PID 11045 (operapluginwrap)
Вообще, посылка 9-ки - это известный workaround для случая
хреновой реализации тредов (а старом ACE так нужно было делать).