Detect PIDs better, but fall back to old method if /proc isn't available.