bug-hurd
[Top][All Lists]
Advanced

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

[PATCH 10/17] libnetfs: register libnetfs-based translators as important


From: Justus Winter
Subject: [PATCH 10/17] libnetfs: register libnetfs-based translators as important
Date: Thu, 15 Aug 2013 09:38:00 +0200

Register libnetfs-based translators running as root as important
processes at the proc server.

* libnetfs/init-startup.c (netfs_startup): Mark us as important.
---
 libnetfs/init-startup.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libnetfs/init-startup.c b/libnetfs/init-startup.c
index 2e0f43a..e17c4f1 100644
--- a/libnetfs/init-startup.c
+++ b/libnetfs/init-startup.c
@@ -48,5 +48,19 @@ netfs_startup (mach_port_t bootstrap, int flags)
 
   mach_port_deallocate (mach_task_self (), bootstrap);
 
+  /* Mark us as important.  */
+  mach_port_t proc = getproc ();
+  if (proc == MACH_PORT_NULL)
+    error (12, err, "Translator startup failure: getproc");
+
+  err = proc_mark_important (proc);
+
+  /* This might fail due to permissions or because the old proc server
+     is still running, ignore any such errors.  */
+  if (err && err != EPERM && err != EMIG_BAD_ID)
+    error (13, err, "Translator startup failure: proc_mark_important");
+
+  mach_port_deallocate (mach_task_self (), proc);
+
   return realnode;
 }
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]