[問題] userspace & kernel space 溝通

看板LinuxDev作者 (yshihyu)時間9年前 (2016/03/16 21:48), 編輯推噓1(102)
留言3則, 3人參與, 最新討論串1/1
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://www.ptt.cc/bbs/LinuxDev/M.1458136106.A.DEC.html

03/16 23:16, , 1F
請愛用netlink
03/16 23:16, 1F

03/21 18:43, , 2F
請愛用netlink
03/21 18:43, 2F

03/28 08:54, , 3F
改用netlink
03/28 08:54, 3F
文章代碼(AID): #1MwMGgti (LinuxDev)
文章代碼(AID): #1MwMGgti (LinuxDev)