Reverted and applied Simon's xcore patch
authorReto Achermann <acreto@student.ethz.ch>
Sun, 3 Aug 2014 14:53:30 +0000 (16:53 +0200)
committerStefan Kaestle <stefan.kaestle@inf.ethz.ch>
Thu, 21 Aug 2014 08:47:50 +0000 (10:47 +0200)
diff --git a/lib/barrelfish/spawn_client.c
b/lib/barrelfish/spawn_client.c
index 6365801..05ccb30 100644
--- a/lib/barrelfish/spawn_client.c
+++ b/lib/barrelfish/spawn_client.c
@@ -21,6 +21,7 @@
 #include <barrelfish/spawn_client.h>
 #include <barrelfish/cpu_arch.h>
 #include <if/spawn_rpcclient_defs.h>
+#include <if/monitor_defs.h>
 #include <vfs/vfs_path.h>

 extern char **environ;
@@ -189,6 +190,13 @@ errval_t spawn_program_with_caps(coreid_t coreid,
const char *path,
         path = pathbuf;
     }

+    // XXX: HACK: change waitset on monitor binding temporarily so we
get UMP
+    // cap transfer notifications!
+    struct monitor_binding *mb = get_monitor_binding();
+    struct waitset *mon_ws = mb->waitset;
+    mb->change_waitset(mb, &cl->rpc_waitset);
+
+
     if (capref_is_null(inheritcn_cap) && capref_is_null(argcn_cap)) {
         err = cl->vtbl.spawn_domain(cl, path, argstr, argstrlen,
                                     envstr, envstrlen,
@@ -203,13 +211,15 @@ errval_t spawn_program_with_caps(coreid_t coreid,
const char *path,
     if (err_is_fail(err)) {
         USER_PANIC_ERR(err, "error sending spawn request");
     } else if (err_is_fail(msgerr)) {
-        return msgerr;
+        goto out;
     }

     if (ret_domainid != NULL) {
         *ret_domainid = domain_id;
     }

+out:
+    mb->change_waitset(mb, mon_ws);
     return msgerr;
 }

if/spawn.if
lib/barrelfish/spawn_client.c
usr/spawnd/service.c

index 2fc87a5..0990dac 100644 (file)
@@ -19,13 +19,6 @@ interface spawn "Interface to spawn domains" {
                                in char envbuf[envbytes], in cap inheritcn_cap,
                                in cap argcn_cap, out errval err,
                                out domainid domain_id);
-    
-    /*
-     * XXX: little hack to allow spawning with caps using UMP
-     */                     
-    rpc spawn_domain_with_argcap(in string path, in char argvbuf[argvbytes],
-                               in char envbuf[envbytes], in cap argcn_cap, 
-                               out errval err, out domainid domain_id);
 
     rpc use_local_memserv();
     rpc kill(in domainid domain_id, out errval err);
index 3c8654a..de6875e 100644 (file)
@@ -22,6 +22,7 @@
 #include <barrelfish/cpu_arch.h>
 #include <if/spawn_rpcclient_defs.h>
 #include <if/arrakis_rpcclient_defs.h>
+#include <if/monitor_defs.h>
 #include <vfs/vfs_path.h>
 
 extern char **environ;
@@ -243,14 +244,19 @@ errval_t spawn_program_with_caps(coreid_t coreid, const char *path,
         path = pathbuf;
     }
 
+    // XXX: HACK: change waitset on monitor binding temporarily so we get UMP
+    // cap transfer notifications!
+    struct monitor_binding *mb = get_monitor_binding();
+    struct waitset *mon_ws = mb->waitset;
+    mb->change_waitset(mb, &cl->rpc_waitset);
+
+
+
+
     if (capref_is_null(inheritcn_cap) && capref_is_null(argcn_cap)) {
         err = cl->vtbl.spawn_domain(cl, path, argstr, argstrlen,
                                     envstr, envstrlen,
                                     &msgerr, &domain_id);
-    } else if (capref_is_null(inheritcn_cap)) {
-        err = cl->vtbl.spawn_domain_with_argcap(cl, path, argstr, argstrlen,
-                                              envstr, envstrlen,
-                                              argcn_cap, &msgerr, &domain_id);
     } else {
         err = cl->vtbl.spawn_domain_with_caps(cl, path, argstr, argstrlen,
                                               envstr, envstrlen, inheritcn_cap,
@@ -259,13 +265,15 @@ errval_t spawn_program_with_caps(coreid_t coreid, const char *path,
     if (err_is_fail(err)) {
         USER_PANIC_ERR(err, "error sending spawn request");
     } else if (err_is_fail(msgerr)) {
-        return msgerr;
+        goto out;
     }
 
     if (ret_domainid != NULL) {
         *ret_domainid = domain_id;
     }
 
+out:
+    mb->change_waitset(mb, mon_ws);
     return msgerr;
 }
 
index 3c33d6a..df4a61f 100644 (file)
@@ -363,14 +363,6 @@ static void spawn_with_caps_handler(struct spawn_binding *b, char *path,
     free(path);
 }
 
-static void spawn_with_argcap_handler(struct spawn_binding *b, char *path,
-                                    char *argbuf, size_t argbytes,
-                                    char *envbuf, size_t envbytes,
-                                    struct capref argcn_cap)
-{
-    spawn_with_caps_handler(b, path, argbuf, argbytes, envbuf, envbytes,
-                            NULL_CAP, argcn_cap);
-}
 
 static void spawn_handler(struct spawn_binding *b, char *path, char *argbuf,
                           size_t argbytes, char *envbuf, size_t envbytes)
@@ -561,7 +553,6 @@ static void status_handler(struct spawn_binding *b, domainid_t domainid)
 
 static struct spawn_rx_vtbl rx_vtbl = {
     .spawn_domain_call = spawn_handler,
-    .spawn_domain_with_argcap_call = spawn_with_argcap_handler,
     .spawn_domain_with_caps_call = spawn_with_caps_handler,
     .use_local_memserv_call = use_local_memserv_handler,
     .kill_call = kill_handler,