#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 */
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))
#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;
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 */
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);
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 *
(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);