spawn_with_cap: workaround
authorReto Achermann <acreto@student.ethz.ch>
Sat, 2 Aug 2014 18:32:10 +0000 (20:32 +0200)
committerStefan Kaestle <stefan.kaestle@inf.ethz.ch>
Wed, 20 Aug 2014 21:44:02 +0000 (23:44 +0200)
Added a workaround to spawn_with_cap to take just one capability in
order to make UMP spawning with one argcap work.

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

index 0990dac..2fc87a5 100644 (file)
@@ -19,6 +19,13 @@ 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 4b68065..3c8654a 100644 (file)
@@ -247,6 +247,10 @@ errval_t spawn_program_with_caps(coreid_t coreid, const char *path,
         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,
index df4a61f..3c33d6a 100644 (file)
@@ -363,6 +363,14 @@ 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)
@@ -553,6 +561,7 @@ 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,