summaryrefslogtreecommitdiff
path: root/libtrivfs
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2013-08-15 09:38:01 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-08-29 01:53:27 +0200
commite3c51fc088975f5b74e68a314e8fdfc907ad9640 (patch)
treef505cbc5c8cf3fabbf160303a897d6652c5f2e42 /libtrivfs
parent5b7ec73d4a310b2ca8322124285a22bad56286d5 (diff)
libtrivfs: register libtrivfs-based translators as important
Register libtrivfs-based translators running as root as important processes at the proc server. * libtrivfs/startup.c (trivfs_startup): Mark us as important.
Diffstat (limited to 'libtrivfs')
-rw-r--r--libtrivfs/startup.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libtrivfs/startup.c b/libtrivfs/startup.c
index 86b0f827..4d76d47c 100644
--- a/libtrivfs/startup.c
+++ b/libtrivfs/startup.c
@@ -65,5 +65,24 @@ trivfs_startup(mach_port_t bootstrap, int flags,
if (!err && control)
*control = fsys;
+ /* Mark us as important. */
+ if (! err)
+ {
+ mach_port_t proc = getproc ();
+ if (proc == MACH_PORT_NULL)
+ /* /hurd/exec uses libtrivfs. We have no handle to the proc
+ server in /hurd/exec when it does its handshake with the
+ root filesystem, so fail graciously here. */
+ return 0;
+
+ 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 == EPERM || err == EMIG_BAD_ID)
+ err = 0;
+
+ mach_port_deallocate (mach_task_self (), proc);
+ }
+
return err;
}