Skip to content

Commit

Permalink
Use rlim_t where appropriate
Browse files Browse the repository at this point in the history
I got the following then trying to compile CRIU on ARM with clang:

> criu/cr-restore.c:2476:22: error: implicit conversion from 'unsigned
> long long' to 'unsigned long' changes value from 18446744073709551615 to
> 4294967295 [-Werror,-Wconstant-conversion]
>         return ival == -1 ? RLIM_INFINITY : ival;
>         ~~~~~~              ^~~~~~~~~~~~~
> /usr/include/arm-linux-gnueabihf/bits/resource.h:117:24: note: expanded
> from macro 'RLIM_INFINITY'
> # define RLIM_INFINITY 0xffffffffffffffffuLL
>                        ^~~~~~~~~~~~~~~~~~~~~
> 1 error generated.

Fix by using provided rlim_t type in this and similar places.

travis-ci: success for Fixes to compile on arm with clang
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
  • Loading branch information
kolyshkin authored and xemul committed Nov 12, 2016
1 parent 70e3b46 commit d6d034a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion criu/cr-dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static int dump_task_fs(pid_t pid, struct parasite_dump_misc *misc, struct cr_im
return pb_write_one(img_from_set(imgset, CR_FD_FS), &fe, PB_FS);
}

static inline u_int64_t encode_rlim(unsigned long val)
static inline rlim_t encode_rlim(rlim_t val)
{
return val == RLIM_INFINITY ? -1 : val;
}
Expand Down
2 changes: 1 addition & 1 deletion criu/cr-restore.c
Original file line number Diff line number Diff line change
Expand Up @@ -2352,7 +2352,7 @@ static int prep_sched_info(struct rst_sched_param *sp, ThreadCoreEntry *tc)
return 0;
}

static unsigned long decode_rlim(u_int64_t ival)
static rlim_t decode_rlim(rlim_t ival)
{
return ival == -1 ? RLIM_INFINITY : ival;
}
Expand Down

0 comments on commit d6d034a

Please sign in to comment.