From 868a820a19ff66c370cf40573ac89738386513c3 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Fri, 16 May 2014 10:13:02 +0200 Subject: proc: move translation functions to mig-decls.h * proc/hash.c (reqport_find): Move this function... * proc/proc.h (process_drop): ... and this... * proc/mig-decls.h: ... here and rename them. * proc/mig-mutate.h: Update accordingly. --- proc/mig-decls.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'proc/mig-decls.h') diff --git a/proc/mig-decls.h b/proc/mig-decls.h index 0d5bd4df..7d36a870 100644 --- a/proc/mig-decls.h +++ b/proc/mig-decls.h @@ -24,6 +24,24 @@ #include "proc.h" +/* Find the process corresponding to a given request port. */ +static inline struct proc * __attribute__ ((unused)) +begin_using_proc_port (mach_port_t port) +{ + struct proc *p; + p = ports_lookup_port (proc_bucket, port, proc_class); + if (p && p->p_dead) + ports_port_deref (p); + return (!p || p->p_dead) ? NULL : p; +} + +static inline void __attribute__ ((unused)) +end_using_proc (struct proc *p) +{ + if (p) + ports_port_deref (p); +} + typedef struct exc* exc_t; static inline exc_t __attribute__ ((unused)) -- cgit v1.2.3