drops passing in flags to pl_chcontext
authorMarc Fiuczynski <mef@cs.princeton.edu>
Thu, 31 May 2007 18:21:52 +0000 (18:21 +0000)
committerMarc Fiuczynski <mef@cs.princeton.edu>
Thu, 31 May 2007 18:21:52 +0000 (18:21 +0000)
lib/planetlab.c
lib/planetlab.h
python/vserverimpl.c
src/vsh.c

index 90a97ea..adf6083 100644 (file)
@@ -48,20 +48,17 @@ POSSIBILITY OF SUCH DAMAGE.
 #include "planetlab.h"
 
 static int
-create_context(xid_t ctx, uint32_t flags, uint64_t bcaps, struct sliver_resources *slr)
+create_context(xid_t ctx, uint64_t bcaps, struct sliver_resources *slr)
 {
   struct vc_ctx_caps  vc_caps;
 
   /*
    * Create context info - this sets the STATE_SETUP and STATE_INIT flags.
-   * Don't ever clear the STATE_INIT flag, that makes us the init task.
-   *
-   * XXX - the kernel code allows initial flags to be passed as an arg.
    */
   if (vc_ctx_create(ctx) == VC_NOCTX)
     return -1;
 
-  /* set capabilities - these don't take effect until SETUP flag is unset */
+  /* Set capabilities - these don't take effect until SETUP flag is unset */
   vc_caps.bcaps = bcaps;
   vc_caps.bmask = ~0ULL;  /* currently unused */
   vc_caps.ccaps = 0;      /* don't want any of these */
@@ -80,6 +77,8 @@ pl_setup_done(xid_t ctx)
   struct vc_ctx_flags  vc_flags;
 
   /* unset SETUP flag - this allows other processes to migrate */
+
+  /* Don't clear the STATE_INIT flag, as that would make us the init task. */
   vc_flags.mask = VC_VXF_STATE_SETUP;
   vc_flags.flagword = 0;
   if (vc_set_cflags(ctx, &vc_flags))
@@ -91,7 +90,7 @@ pl_setup_done(xid_t ctx)
 #define RETRY_LIMIT  10
 
 int
-pl_chcontext(xid_t ctx, uint32_t flags, uint64_t bcaps, struct sliver_resources *slr)
+pl_chcontext(xid_t ctx, uint64_t bcaps, struct sliver_resources *slr)
 {
   int  retry_count = 0;
 
@@ -105,7 +104,7 @@ pl_chcontext(xid_t ctx, uint32_t flags, uint64_t bcaps, struct sliver_resources
            return -1;
 
          /* context doesn't exist - create it */
-         if (create_context(ctx, flags, bcaps,slr))
+         if (create_context(ctx, bcaps,slr))
            {
              if (errno == EEXIST)
                /* another process beat us in a race */
index ed248a2..739bac6 100644 (file)
@@ -49,7 +49,7 @@ struct sliver_resources {
 int adjust_lim(struct vc_rlimit *vcr, struct rlimit *lim);
 
 int
-pl_chcontext(xid_t ctx, uint32_t flags, uint64_t bcaps, struct sliver_resources *slr);
+pl_chcontext(xid_t ctx, uint64_t bcaps, struct sliver_resources *slr);
 
 int
 pl_setup_done(xid_t ctx);
index 15388ee..4afba2a 100644 (file)
@@ -60,18 +60,17 @@ POSSIBILITY OF SUCH DAMAGE.
 static PyObject *
 vserver_chcontext(PyObject *self, PyObject *args)
 {
-  int  result;
+  int  ctx_is_new;
   xid_t  ctx;
-  uint32_t  flags = 0;
-  uint32_t  bcaps = ~vc_get_insecurebcaps();
+  uint_least64_t bcaps = ~vc_get_insecurebcaps();
 
-  if (!PyArg_ParseTuple(args, "I|K", &ctx, &flags))
+  if (!PyArg_ParseTuple(args, "I", &ctx))
     return NULL;
 
-  if ((result = pl_chcontext(ctx, flags, bcaps, 0)) < 0)
+  if ((ctx_is_new = pl_chcontext(ctx, bcaps, 0)) < 0)
     return PyErr_SetFromErrno(PyExc_OSError);
 
-  return PyBool_FromLong(result);
+  return PyBool_FromLong(ctx_is_new);
 }
 
 static PyObject *
index b80b8d8..ee6ba76 100644 (file)
--- a/src/vsh.c
+++ b/src/vsh.c
@@ -224,7 +224,7 @@ static int sandbox_processes(xid_t ctx, char *context)
 
        (void) (sandbox_chroot(ctx));
 
-        if ((ctx_is_new = pl_chcontext(ctx, 0, ~vc_get_insecurebcaps(),&slr)) < 0)
+        if ((ctx_is_new = pl_chcontext(ctx, ~vc_get_insecurebcaps(),&slr)) < 0)
           {
             PERROR("pl_chcontext(%u)", ctx);
             exit(1);