Hi. I perform in FOREACH_PROC_IN_SYSTEM(), where I conditionally look at p_vmspace internals. I'd like to know the safe way to reference p_vmspace fields without potential null-dereference.
I see an example in vm_pageout_oom(), where making access to p->p_vmspace fields is done without additional checks. Nevertheless I want to further catch on how it works. Currently I additionally explicitly check on P_SYSTEM and PRS_NEW, then p->p_vmspace against NULL. So I'd wish to understand if a time-window between 1) placing a new process to proclist and 2) attaching vmspace to this process is possible at all, and then in what cases. I see in fork1() that a new process' (named p2 here) state is set to PRS_NEW just before LIST_INSERT_HEAD(&allproc, p2, p_list) and then (after vmspace is already attached in vm_forkproc()) is set to PRS_NORMAL. So an additional check on p_vmspace != NULL is not need. Am I right? Thanks. -- wbr, pluknet _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"