0
我試圖通過sysctl接口Linux和KERN_PROC
int mib[4] = {0};
size_t len = sizeof(mib)/sizeof(int);
struct kinfo_proc kp;
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PID;
mib[3] = 3027;
sysctl(mib, 4, &kp, &len, NULL, 0);
Error:
test.cpp: In function ‘int main(int, char**)’:
test.cpp:13:22: error: aggregate ‘main(int, char**)::kinfo_proc kp’ has incomplete type and cannot be defined
test.cpp:16:13: error: ‘KERN_PROC’ was not declared in this scope
有一個很好的外觀,但沒有明確的答案,讓另一個進程的信息。 Linux是否通過sysctl
系統調用支持KERN_PROC
。
發行:Centos的6.2
感謝您的回覆。是的,我檢查了這些標題並且它丟失了,我只是處於拒絕狀態。我真的想用最小的改變移植應用程序;/proc我必須去:( – Corvusoft