From the manual it seems that ps -AO wchan should tell me what everything is sleeping on, but everything comes up as -. (And nwchan as 0). Did they do away with the old sleep()/tsleep() interface in the kernel, or do I need to tweak some setting to get at the information?
And if p->p_wchan is actually always zero in Darwin 11, is there another way find out what processes are waiting for?
EDIT: Indeed, p->p_wchan isn't even defined in the internal struct proc, the sysctl interface just zeroes out the fields when exporting. There's uu_wchan and uu_wmesg members in struct uthread, set by the _sleep interface and through that by the emulated tsleep function, but I haven't found anything to make those available to userland. ps -MAO wchan doesn't, for one.
(The whole struct uthread thing seems to be a very specific to XNU, a way of retrofitting FreeBSD interfaces onto Mach, so there's little hope of finding solutions from elsewhere).