[CRIU] [PATCH 21/23] restorer: wrapped the syscall sys_setrlimit

Pavel Emelyanov xemul at parallels.com
Mon Jan 14 05:44:32 EST 2013


On 01/14/2013 02:30 PM, Alexander Kartashov wrote:
> On 01/14/2013 02:10 PM, Pavel Emelyanov wrote:
>> As far as I see from the ARM patch struct krlimir and struct rlimit
>> do not differ. What's wrong?
> 
> Probably it's a feature of Debian. In the ARM patch i declare
> the struct krlimit in the following way:
> 
> struct krlimit {
>         unsigned long rlim_cur;
>         unsigned long rlim_max;
> };
> 
> The struct rlimit is declared in the following way in the system headers:
> 
> /* Type for resource quantity measurement.  */
> #ifndef __USE_FILE_OFFSET64
> typedef __rlim_t rlim_t;
> #else
> typedef __rlim64_t rlim_t;
> #endif
> #ifdef __USE_LARGEFILE64
> typedef __rlim64_t rlim64_t;
> #endif
> 
> struct rlimit
>    {
>      /* The current (soft) limit.  */
>      rlim_t rlim_cur;
>      /* The hard limit.  */
>      rlim_t rlim_max;
>    };
> 
> Since the macro FILE_OFFSET_BITS is 64 the fields cur and lim
> becomes 64-bit long that results in a mismatch between the kernel
> and user declarations of the struct rlimit in this case.
> 
> I tried to remove the macro definition but it only made things worse.
> 


Brr... OK. Then there's not need in arch_setrlimit. Just redeclare
the struct rlimit all over the code into strictly defined one.


More information about the CRIU mailing list