+ if (ctx_is_new)
+ {
+ /* set resources */
+ struct vc_rlimit limits;
+
+ limits.min = VC_LIM_KEEP;
+ limits.soft = VC_LIM_KEEP;
+ limits.hard = mem;
+ if (vc_set_rlimit(ctx, RLIMIT_RSS, &limits))
+ {
+ PERROR("pl_setrlimit(%u, RLIMIT_RSS)", ctx);
+ exit(1);
+ }
+ limits.hard = task;
+ if (vc_set_rlimit(ctx, RLIMIT_NPROC, &limits))
+ {
+ PERROR("pl_setrlimit(%u, RLIMIT_NPROC)", ctx);
+ exit(1);
+ }
+ cpuguaranteed &= VS_SCHED_CPU_GUARANTEED;
+ if (pl_setsched(ctx, cpu, cpuguaranteed) < 0)
+ {
+ PERROR("pl_setsched(&u)", ctx);
+ exit(1);
+ }
+ pl_setup_done(ctx);
+ }