}
inline static WRAPPER_DECL void
-Evc_ctx_migrate(xid_t xid)
+Evc_ctx_migrate(xid_t xid, uint_least64_t flags)
{
- FatalErrnoError(vc_ctx_migrate(xid)==-1, "vc_ctx_migrate()");
+ FatalErrnoError(vc_ctx_migrate(xid, flags)==-1, "vc_ctx_migrate()");
}
inline static WRAPPER_DECL void
#endif
static inline ALWAYSINLINE int
-vc_ctx_migrate_spaces(xid_t xid)
+vc_ctx_migrate_spaces(xid_t xid, uint_least64_t flags)
{
- int ret = vc_getXIDType(xid);
+ int ret;
+ struct vcmd_ctx_migrate data = { .flagword = flags };
+
+ ret = vc_getXIDType(xid);
if (ret == vcTYPE_STATIC || ret == vcTYPE_DYNAMIC) {
ret = vc_enter_namespace(xid, vc_get_space_mask() & ~(CLONE_NEWNS|CLONE_FS));
if (ret)
return ret;
}
- return vserver(VCMD_ctx_migrate_v0, CTX_USER2KERNEL(xid), NULL);
+ return vserver(VCMD_ctx_migrate, CTX_USER2KERNEL(xid), &data);
}
#if defined(VC_ENABLE_API_V13) || defined(VC_ENABLE_API_V21)
int
-vc_ctx_migrate(xid_t xid)
+vc_ctx_migrate(xid_t xid, uint_least64_t flags)
{
- CALL_VC(CALL_VC_SPACES(vc_ctx_migrate, xid),
+ CALL_VC(CALL_VC_SPACES(vc_ctx_migrate, xid, flags),
CALL_VC_V13A (vc_ctx_migrate, xid));
}
#endif
#define VC_DATTR_REMAP 0x00000010
+// the process context migration flags
+#define VC_VXM_SET_INIT 0x00000001
+#define VC_VXM_SET_REAPER 0x00000002
+
+
#ifndef CLONE_NEWNS
# define CLONE_NEWNS 0x00020000
#endif
/** \brief Moves the current process into the specified context.
* \ingroup syscalls
*
- * \param xid The new context
+ * \param xid The new context
+ * \param flags The flags, see VC_VXM_*
* \returns 0 on success, -1 on errors */
- int vc_ctx_migrate(xid_t xid);
+ int vc_ctx_migrate(xid_t xid, uint_least64_t flags);
/** \brief Statistics about a context */
struct vc_ctx_stat {
if (vc_get_task_xid(0)==1) return true;
if (vc_isSupported(vcFEATURE_MIGRATE)) {
- if (vc_ctx_migrate(1)==-1) {
+ if (vc_ctx_migrate(1, 0)==-1) {
if (errptr) *errptr = "vc_migrate_context()";
return false;
}
Evc_set_cflags(xid, &flags);
}
else if (vc_isSupported(vcFEATURE_MIGRATE))
- Evc_ctx_migrate(xid);
+ Evc_ctx_migrate(xid, 0);
else {
#ifdef VC_ENABLE_API_COMPAT
Evc_new_s_context(xid, xid_caps, xid_flags);
int res = -1;
if (vc_isSupported(vcFEATURE_MIGRATE))
- res = vc_ctx_migrate(ctx);
+ res = vc_ctx_migrate(ctx, 0);
else {
#ifdef VC_ENABLE_API_COMPAT
res = vc_new_s_context(ctx,caps,flags);
setFlags(args, xid);
if (args->do_migrate && !args->do_migrateself)
- Evc_ctx_migrate(xid);
+ Evc_ctx_migrate(xid, 0);
if (args->uid != NULL) {
uid_t uid = 0;