作者yshihyu (yshihyu)
看板LinuxDev
标题[问题] userspace & kernel space 沟通
时间Wed Mar 16 21:47:59 2016
https://gist.github.com/anonymous/bb7623c4c2c2b31fe288
因为程式码有点多所以我贴再上面网址里面
我程式是想从 使用者空间的appln process 透过 ioctl 传递 process 的
pid 到 kernel , kernel 再透过 send_sig 函数不断发 SIGUSR2 给用使用者空间的
appln prcoess , 当我不想kernel 再发 SIGUSR2 signal .
我再透过 ioctl 让 kernel 停止发 SIGUSR2
下面是打印出来的log 是正常的
// user space log
PID=6897
Ioctl executed
signal_handler 12, pid=6897
SIGUSR2
signal_handler 12, pid=6897
SIGUSR2
^Cstop_sig=2, pid=6897 // ctrl + c 发往 kernel 让kernel停止发送 SIGUSR2
// kernel log
[ 681.335568] vrmonitor_sig_handler current pid=6898 send to PID=6897
[ 682.339540] vrmonitor_sig_handler current pid=6898 send to PID=6897
[ 682.871588] IOCTL_STOP_SIG send_sig_flag=0 // kernel 收到停止发送
[ 682.871646] Module Released
[ 683.343531] vrmonitor_sig_handler current pid=6898 send to PID=6897
我再一般pc上运行正常 ,
可是再 vmware ubuntu kernel 只发两次 SIGUSR2 , 就打印出 Module Released
下面 log , user space 的 appln prcoess 就莫名其妙结束 , 我还没按 ctrl+c
只是启动 sudo ./appln 这样
[ 681.335568] vrmonitor_sig_handler current pid=6898 send to PID=6897
[ 682.339540] vrmonitor_sig_handler current pid=6898 send to PID=6897
[ 682.871646] Module Released
请问可能是什麽原因会有这样怪异现象?
谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 175.182.197.52
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/LinuxDev/M.1458136106.A.DEC.html
1F:→ ah7675: 请爱用netlink 03/16 23:16
2F:→ leolarrel: 请爱用netlink 03/21 18:43
3F:推 impotent: 改用netlink 03/28 08:54