- if (__probable(code != 180))
- KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,
- BSDDBG_CODE(DBG_BSD_EXCP_SC, code) | DBG_FUNC_END,
- error, uthread->uu_rval[0], uthread->uu_rval[1], p->p_pid, 0);
+ if (__probable(!code_is_kdebug_trace(code))) {
+ KDBG_RELEASE(BSDDBG_CODE(DBG_BSD_EXCP_SC, code) | DBG_FUNC_END,
+ error, uthread->uu_rval[0], uthread->uu_rval[1], pid);
+ }
+
+#if PROC_REF_DEBUG
+ if (__improbable(uthread_get_proc_refcount(uthread))) {
+ panic("system call returned with uu_proc_refcount != 0");
+ }
+#endif