> FOREACH_PROC_IN_SYSTEM(p) {
> mtx_lock(&Giant);
> PROC_LOCK(p);
> printf("%d %d\n", (int)p->p_stats->p_ru.ru_isrss,
> (int)p->p_stats->p_ru.ru_idrss);
> PROC_UNLOCK(p);
> mtx_unlock(&Giant);
> }
This code is incorrect, because you should get sx_slock(&allproc_lock)
before FOREACH_PROC_IN_SYSTEM and release sx_sunlock(&allproc_lock)
after this loop. If you don't do this, then p in some iteration
will point to nothing. Locking Giant, as I understand, here is not
required (even vefore FOREACH_...).
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"