Index: vserver-sources-2.1.1_2.6.15.4/include/linux/vserver/context.h =================================================================== --- vserver-sources-2.1.1_2.6.15.4.orig/include/linux/vserver/context.h +++ vserver-sources-2.1.1_2.6.15.4/include/linux/vserver/context.h @@ -56,6 +56,11 @@ #define VXF_INIT_SET (VXF_STATE_SETUP|VXF_STATE_INIT) +/* context migration */ + +#define VXM_SET_INIT 0x00000001 +#define VXM_SET_REAPER 0x00000002 + /* context caps */ #define VXC_CAP_MASK 0x00000000 Index: vserver-sources-2.1.1_2.6.15.4/include/linux/vserver/context_cmd.h =================================================================== --- vserver-sources-2.1.1_2.6.15.4.orig/include/linux/vserver/context_cmd.h +++ vserver-sources-2.1.1_2.6.15.4/include/linux/vserver/context_cmd.h @@ -34,7 +34,12 @@ struct vcmd_ctx_create { uint64_t flagword; }; -#define VCMD_ctx_migrate VC_CMD(PROCMIG, 1, 0) +#define VCMD_ctx_migrate_v0 VC_CMD(PROCMIG, 1, 0) +#define VCMD_ctx_migrate VC_CMD(PROCMIG, 1, 1) + +struct vcmd_ctx_migrate { + uint64_t flagword; +}; #ifdef __KERNEL__ extern int vc_ctx_create(uint32_t, void __user *); Index: vserver-sources-2.1.1_2.6.15.4/kernel/vserver/context.c =================================================================== --- vserver-sources-2.1.1_2.6.15.4.orig/kernel/vserver/context.c +++ vserver-sources-2.1.1_2.6.15.4/kernel/vserver/context.c @@ -849,10 +849,13 @@ int vc_ctx_create(uint32_t xid, void __u int vc_ctx_migrate(uint32_t id, void __user *data) { + struct vcmd_ctx_migrate vc_data = { .flagword = 0 }; struct vx_info *vxi; if (!capable(CAP_SYS_ADMIN)) return -EPERM; + if (data && copy_from_user (&vc_data, data, sizeof(vc_data))) + return -EFAULT; /* dirty hack until Spectator becomes a cap */ if (id == 1) { @@ -864,6 +867,10 @@ int vc_ctx_migrate(uint32_t id, void __u if (!vxi) return -ESRCH; vx_migrate_task(current, vxi); + if (vc_data.flagword & VXM_SET_INIT) + vx_set_init(vxi, current); + if (vc_data.flagword & VXM_SET_REAPER) + vx_set_reaper(vxi, current); put_vx_info(vxi); return 0; } Index: vserver-sources-2.1.1_2.6.15.4/kernel/vserver/switch.c =================================================================== --- vserver-sources-2.1.1_2.6.15.4.orig/kernel/vserver/switch.c +++ vserver-sources-2.1.1_2.6.15.4/kernel/vserver/switch.c @@ -219,6 +219,8 @@ long do_vserver(uint32_t cmd, uint32_t i return vc_ctx_create(id, NULL); case VCMD_ctx_create: return vc_ctx_create(id, data); + case VCMD_ctx_migrate_v0: + return vc_ctx_migrate(id, NULL); case VCMD_ctx_migrate: return vc_ctx_migrate(id, data);