#define P_LIST_INPGRP 0x00020000 /* process is in pgrp */
#define P_LIST_PGRPTRANS 0x00040000 /* pgrp is getting replaced */
#define P_LIST_PGRPTRWAIT 0x00080000 /* wait for pgrp replacement */
-#define P_LIST_EXITCOUNT 0x00100000 /* counted for process exit */
+#define P_LIST_EXITCOUNT 0x00100000 /* counted for process exit */
+#define P_LIST_REFWAIT 0x00200000 /* wait to take a ref */
/* local flags */
#define P_LLIMWAIT 0x00040000
#define P_LWAITED 0x00080000
#define P_LINSIGNAL 0x00100000
-#define P_LRETURNWAIT 0x00200000 /* process is completing spawn/vfork-exec/fork */
#define P_LRAGE_VNODES 0x00400000
#define P_LREGISTER 0x00800000 /* thread start fns registered */
#define P_LVMRSRCOWNER 0x01000000 /* can handle the resource ownership of */
-#define P_LRETURNWAITER 0x02000000 /* thread is waiting on P_LRETURNWAIT being cleared */
#define P_LTERM_DECRYPTFAIL 0x04000000 /* process terminating due to key failure to decrypt */
#define P_LTERM_JETSAM 0x08000000 /* process is being jetsam'd */
#define P_JETSAM_VMPAGESHORTAGE 0x00000000 /* jetsam: lowest jetsam priority proc, killed due to vm page shortage */
#define PROC_SETACTION_STATE(p) (p->p_pcaction = (PROC_CONTROL_STATE(p) | (PROC_CONTROL_STATE(p) << 16)))
#define PROC_RESETACTION_STATE(p) (p->p_pcaction = PROC_CONTROL_STATE(p))
+/* Process exit reason macros */
+#define PROC_HAS_EXITREASON(p) (p->p_exit_reason != OS_REASON_NULL)
+#define PROC_EXITREASON_FLAGS(p) p->p_exit_reason->osr_flags
+
/* additional process flags */
#define P_LADVLOCK 0x01
#define P_LXBKIDLEINPROG 0x02
extern proc_t proc_findinternal(int pid, int locked);
extern proc_t proc_findthread(thread_t thread);
extern void proc_refdrain(proc_t);
+extern proc_t proc_refdrain_with_refwait(proc_t p, boolean_t get_ref_and_allow_wait);
+extern void proc_refwake(proc_t p);
extern void proc_childdrainlocked(proc_t);
extern void proc_childdrainstart(proc_t);
extern void proc_childdrainend(proc_t);
#endif /* PSYNCH */
struct uthread * current_uthread(void);
-void proc_set_return_wait(struct proc *);
-void proc_clear_return_wait(proc_t p, thread_t child_thread);
-void proc_wait_to_return(void);
-
/* process iteration */
#define ALLPROC_FOREACH(var) \