Change proc_mgmt/pending_clients.h to use reply queues instead of hashtables.
[barrelfish] / usr / spawnd / service.c
index 5fea71c..0706aae 100644 (file)
@@ -386,7 +386,7 @@ static void spawn_with_caps_request_handler(struct spawn_binding *b,
                                  &dummy_domain_id);
 
 reply:
-    reply_err = b->tx_vtbl.spawn_with_caps_reply(b, NOP_CONT, domain_cap, err);
+    reply_err = b->tx_vtbl.spawn_reply(b, NOP_CONT, err);
     if (err_is_fail(reply_err)) {
         DEBUG_ERR(err, "failed to send spawn_with_caps_reply");
     }
@@ -419,7 +419,7 @@ static void spawn_request_handler(struct spawn_binding *b,
                                  &dummy_domain_id);
 
 reply:
-    reply_err = b->tx_vtbl.spawn_reply(b, NOP_CONT, domain_cap, err);
+    reply_err = b->tx_vtbl.spawn_reply(b, NOP_CONT, err);
     if (err_is_fail(reply_err)) {
         DEBUG_ERR(err, "failed to send spawn_reply");
     }
@@ -564,7 +564,7 @@ static void span_request_handler(struct spawn_binding *b,
     }
 
 reply:
-    reply_err = b->tx_vtbl.span_reply(b, NOP_CONT, domain_cap, err);
+    reply_err = b->tx_vtbl.spawn_reply(b, NOP_CONT, err);
     if (err_is_fail(reply_err)) {
         DEBUG_ERR(err, "failed to send span_reply");
     }
@@ -584,53 +584,39 @@ static void cleanup_cap(struct capref cap)
     }
 }
 
-static errval_t kill_handler_common(struct capref procmng_cap,
-                                    struct capref domain_cap)
+static void kill_request_handler(struct spawn_binding *b,
+                                 struct capref procmng_cap,
+                                 struct capref victim_domain_cap)
 {
+    errval_t err, reply_err;
     struct capability ret;
-    errval_t err = monitor_cap_identify_remote(procmng_cap, &ret);
+    err = monitor_cap_identify_remote(procmng_cap, &ret);
     if (err_is_fail(err)) {
-        return err_push(err, SPAWN_ERR_IDENTIFY_PROC_MNGR_CAP);
+        err = err_push(err, SPAWN_ERR_IDENTIFY_PROC_MNGR_CAP);
+        goto reply;
     }
 
     if (ret.type != ObjType_ProcessManager) {
-        return SPAWN_ERR_NOT_PROC_MNGR;
+        err = SPAWN_ERR_NOT_PROC_MNGR;
+        goto reply;
     }
 
     struct ps_entry *pe;
-    err = ps_get_domain(domain_cap, &pe, NULL);
+    err = ps_get_domain(victim_domain_cap, &pe, NULL);
     if (err_is_fail(err)) {
-        return err_push(err, SPAWN_ERR_DOMAIN_NOTFOUND);
+        err = err_push(err, SPAWN_ERR_DOMAIN_NOTFOUND);
+        goto reply;
     }
 
     cleanup_cap(pe->dcb);
 
-    return SYS_ERR_OK;
-}
-
-static void kill_request_handler(struct spawn_binding *b,
-                                 struct capref procmng_cap,
-                                 struct capref victim_domain_cap)
-{
-    errval_t err = kill_handler_common(procmng_cap, victim_domain_cap);
-    errval_t reply_err = b->tx_vtbl.kill_reply(b, NOP_CONT, victim_domain_cap,
-                                               err);
+reply:
+    reply_err = b->tx_vtbl.spawn_reply(b, NOP_CONT, err);
     if (err_is_fail(reply_err)) {
         DEBUG_ERR(err, "failed to send kill_reply");
     }
 }
 
-static void exit_request_handler(struct spawn_binding *b,
-                                 struct capref procmng_cap,
-                                 struct capref domain_cap)
-{
-    errval_t err = kill_handler_common(procmng_cap, domain_cap);
-    errval_t reply_err = b->tx_vtbl.exit_reply(b, NOP_CONT, domain_cap, err);
-    if (err_is_fail(reply_err)) {
-        DEBUG_ERR(err, "failed to send exit_reply");
-    }
-}
-
 static void cleanup_request_handler(struct spawn_binding *b,
                                     struct capref procmng_cap,
                                     struct capref domain_cap)
@@ -664,7 +650,7 @@ static void cleanup_request_handler(struct spawn_binding *b,
     free(pe);
 
 reply:
-    reply_err = b->tx_vtbl.cleanup_reply(b, NOP_CONT, domain_cap, err);
+    reply_err = b->tx_vtbl.spawn_reply(b, NOP_CONT, err);
     if (err_is_fail(reply_err)) {
         DEBUG_ERR(err, "failed to send cleanup_reply");
     }
@@ -865,7 +851,6 @@ static struct spawn_rx_vtbl rx_vtbl = {
     .spawn_with_caps_request = spawn_with_caps_request_handler,
     .span_request            = span_request_handler,
     .kill_request            = kill_request_handler,
-    .exit_request            = exit_request_handler,
     .cleanup_request         = cleanup_request_handler,
 
     .use_local_memserv_call = use_local_memserv_handler,