문제

I'm working on Kext which should have access to struct proc->p_pid field. The problem is the structure is defined in XNU sources only, so I faced incomplete definition of type 'struct proc' error during compilation.

From my point of view, to include XNU headers into my own project is a bad smelling solution, but what is the alternative way? Is it to copy and to paste the structure into my own code?

도움이 되었습니까?

해결책

You're supposed to use proc_pid(proc_t) for this. The structure is meant to be opaque as, if it gets changed between kernel revisions, your code could be accessing the incorrect offset.

I would only include the definitions for structures if I'm doing something nefarious, otherwise I'd go looking for a functional interface.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top