diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2013-08-15 09:38:00 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-08-29 01:53:10 +0200 |
commit | 5b7ec73d4a310b2ca8322124285a22bad56286d5 (patch) | |
tree | f1c19813004ca1efb88405cbb1cbbc62ee033735 | |
parent | 04de8fc618a34d786db9defde983a7f016538e84 (diff) |
libnetfs: register libnetfs-based translators as important
Register libnetfs-based translators running as root as important
processes at the proc server.
* libnetfs/init-startup.c (netfs_startup): Mark us as important.
-rw-r--r-- | libnetfs/init-startup.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libnetfs/init-startup.c b/libnetfs/init-startup.c index 2e0f43a8..e17c4f16 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; } |