Implement kill() and exit() in the process manager.
[barrelfish] / lib / barrelfish / init.c
index 6221a2f..949fcdd 100644 (file)
@@ -25,6 +25,7 @@
 #include <barrelfish/morecore.h>
 #include <barrelfish/monitor_client.h>
 #include <barrelfish/nameservice_client.h>
+#include <barrelfish/proc_mgmt_client.h>
 #include <barrelfish/spawn_client.h>
 #include <barrelfish/systime.h>
 #include <barrelfish_kpi/domain_params.h>
@@ -68,9 +69,14 @@ void libc_exit(int status)
 
         // XXX: Leak all other domain allocations
     } else {
-        err = spawn_exit(status);
-        if(err_is_fail(err)) {
-            DEBUG_ERR(err, "spawn_exit");
+        err = proc_mgmt_exit(status);
+        if (err_is_fail(err)) {
+            // Maybe we have not been spawned through the process manager, but
+            // through spawnd directly (we're some bootstrap domain).
+            err = spawn_exit(status);
+            if (err_is_fail(err)) {
+                DEBUG_ERR(err, "spawn_exit");
+            }
         }
     }