[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 11/16] mach-defpager: register mach-defpager translators as important



Register any mach-defpager translators running as root as
important processes at the proc server.

* mach-defpager/main.c (main): Mark us as important.
---
 mach-defpager/main.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/mach-defpager/main.c b/mach-defpager/main.c
index 3134d6f..adac3c7 100644
--- a/mach-defpager/main.c
+++ b/mach-defpager/main.c
@@ -125,6 +125,18 @@ main (int argc, char **argv)
 	}
     }
 
+  /* Mark us as important.  */
+  mach_port_t proc = getproc ();
+  if (proc == MACH_PORT_NULL)
+    error (3, err, "cannot get a handle to our process");
+
+  err = proc_mark_important (proc);
+  /* This might fail due to permissions, ignore any such errors.  */
+  if (err && err != EPERM)
+    error (3, err, "cannot mark us as important");
+
+  mach_port_deallocate (mach_task_self (), proc);
+
   printf_init(bootstrap_master_device_port);
 
   /*
-- 
1.7.10.4


Reply to: