[CRIU] [RFC] criu: Drop prlimit compat layer

Cyrill Gorcunov gorcunov at gmail.com
Mon Apr 4 06:40:00 PDT 2016


On Mon, Apr 04, 2016 at 04:23:06PM +0300, Pavel Emelyanov wrote:
> > -int prlimit(pid_t pid, int resource, const struct rlimit *new_rlimit, struct rlimit *old_rlimit)
> > -{
> > -	struct rlimit64 new_rlimit64_mem;
> > -	struct rlimit64 old_rlimit64_mem;
> > -	struct rlimit64 *new_rlimit64 = NULL;
> > -	struct rlimit64 *old_rlimit64 = NULL;
> > -	int ret;
> > -
> > -	if (old_rlimit)
> > -		old_rlimit64 = &old_rlimit64_mem;
> > -
> > -	if (new_rlimit) {
> > -		if (new_rlimit->rlim_cur == RLIM_INFINITY)
> > -			new_rlimit64_mem.rlim_cur = RLIM64_INFINITY;
> > -		else
> > -			new_rlimit64_mem.rlim_cur = new_rlimit->rlim_cur;
> > -		if (new_rlimit->rlim_max == RLIM_INFINITY)
> > -			new_rlimit64_mem.rlim_max = RLIM64_INFINITY;
> > -		else
> > -			new_rlimit64_mem.rlim_max = new_rlimit->rlim_max;
> > -		new_rlimit64 = &new_rlimit64_mem;
> > -	}
> 
> You've killed the conversions we did for INIFINITY values. Changing struct rlimit
> to struct rlimit64 works only for 64 bit platforms.

The kernel _must_ provide rlimit64 syscall together with rlimit64 structure.
On 32bit platform the compiler must provide long long operations. The code
above is rather been c'n'p from the libc sources. I think we don't need it
at all with new direct syscall.


More information about the CRIU mailing list