X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=kernel%2Fvserver%2Flegacy.c;h=7ab0b1ebafbdaf5cd4c9fa8eae49347d1214ef90;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=73efdaaa8e6a7ffbcaccc29eac42002a28e6ede0;hpb=cee37fe97739d85991964371c1f3a745c00dd236;p=linux-2.6.git diff --git a/kernel/vserver/legacy.c b/kernel/vserver/legacy.c index 73efdaaa8..7ab0b1eba 100644 --- a/kernel/vserver/legacy.c +++ b/kernel/vserver/legacy.c @@ -10,7 +10,6 @@ * */ -#include #include #include #include @@ -22,14 +21,18 @@ #include +extern int vx_set_init(struct vx_info *, struct task_struct *); static int vx_set_initpid(struct vx_info *vxi, int pid) { - if (vxi->vx_initpid) - return -EPERM; + struct task_struct *init; + + init = find_task_by_real_pid(pid); + if (!init) + return -ESRCH; - vxi->vx_initpid = pid; - return 0; + vxi->vx_flags &= ~VXF_STATE_INIT; + return vx_set_init(vxi, init); } int vc_new_s_context(uint32_t ctx, void __user *data) @@ -74,9 +77,9 @@ int vc_new_s_context(uint32_t ctx, void __user *data) return -EINVAL; if ((ctx == VX_DYNAMIC_ID) || (ctx < MIN_D_CONTEXT)) - new_vxi = locate_or_create_vx_info(ctx); + new_vxi = lookup_or_create_vx_info(ctx); else - new_vxi = locate_vx_info(ctx); + new_vxi = lookup_vx_info(ctx); if (!new_vxi) return -EINVAL; @@ -86,7 +89,7 @@ int vc_new_s_context(uint32_t ctx, void __user *data) vx_info_flags(new_vxi, VX_INFO_PRIVATE, 0)) goto out_put; - new_vxi->vx_flags &= ~(VXF_STATE_SETUP|VXF_STATE_INIT); + new_vxi->vx_flags &= ~VXF_STATE_SETUP; ret = vx_migrate_task(current, new_vxi); if (ret == 0) { @@ -100,6 +103,9 @@ int vc_new_s_context(uint32_t ctx, void __user *data) if (vc_data.flags & VX_INFO_NPROC) new_vxi->limit.rlim[RLIMIT_NPROC] = current->signal->rlim[RLIMIT_NPROC].rlim_max; + + /* tweak some defaults for legacy */ + new_vxi->vx_flags |= (VXF_HIDE_NETIF|VXF_INFO_INIT); ret = new_vxi->vx_id; } out_put: