[問題] 關於process

看板C_and_CPP作者 (tedium of chores)時間11年前 (2012/11/29 18:50), 編輯推噓1(107)
留言8則, 4人參與, 最新討論串3/3 (看更多)
關於interprocess 有點困擾 現在遇到問題是這樣: 有一個running process 已經知道他內容是在做什麼事情 但因為不確定他的parent process跟他有什麼關係 所以打算用IPC(不確定是不是用這個東西)來處理 目的是來把它這隻process 原始的stdin/stdout/psid 都保存好,然後想辦法取得他的process(這邊不知道怎麼做) 之後把這隻process 停掉,再另外用自己的東西替代掉 想要把原本這process 留住,但是內容換掉的概念(或是把它停住) 但是又不想要影響他原本process group/session/tty/parents process 的關係 我的問題可能有點複雜 請問如果這邊用ipc來做的話(如果我的想法沒有錯的話) 該怎麼出發? 或是說我有哪些觀念是錯的! 幫我指正 >_< -- CHUNG TI SU LI !!! PigC jo way !!! TSON GO GER !!!!! 3 ming, zhou 1, 5 don, so zhoung. 1 gian, ming go, 1 gin, da tong. g 2 dor 4 way ming chan fon. su ya fay say zhou 1 Strong. 4 chin 4 yung, B sin B zhoung, 1 sin 1 der, goung tser 4 zhong ! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.211.32.194

11/29 19:00, , 1F
感覺要看exec()系列函數是怎麼做的~"~
11/29 19:00, 1F

11/29 20:55, , 2F
是有找到一些資料是可以導input/output 不過大多都是事先
11/29 20:55, 2F

11/29 20:55, , 3F
parent/child process 都已經寫好,不是runtime去挖別人的
11/29 20:55, 3F

11/29 23:35, , 4F
感覺你會需要用 ptrace(2), 但是可能還是做不到..
11/29 23:35, 4F

11/29 23:54, , 5F
可以你當parent去exec你想要捕捉的process嗎QQ
11/29 23:54, 5F

11/30 02:43, , 6F
能事後hijack 別人process 的方式嗎? XD
11/30 02:43, 6F

12/01 00:01, , 7F
ptrace參考一下><
12/01 00:01, 7F

12/01 23:21, , 8F
謝謝!大感謝!
12/01 23:21, 8F
文章代碼(AID): #1Gjpu9-x (C_and_CPP)
文章代碼(AID): #1Gjpu9-x (C_and_CPP)