Use uint64_t instead of __rlim64_t

This commit is contained in:
Robert Swiecki 2017-10-25 15:44:35 +02:00
parent 9f1639fa9c
commit a1260e49f3
4 changed files with 14 additions and 13 deletions

View File

@ -141,11 +141,12 @@ static bool cgroupInitNsFromParentNetCls(struct nsjconf_t* nsjconf, pid_t pid)
char fname[PATH_MAX];
if (nsjconf->cgroup_net_cls_classid != (unsigned int)0) {
char net_cls_classid_str[512];
snprintf(net_cls_classid_str, sizeof(net_cls_classid_str), "0x%x", nsjconf->cgroup_net_cls_classid);
snprintf(net_cls_classid_str, sizeof(net_cls_classid_str), "0x%x",
nsjconf->cgroup_net_cls_classid);
snprintf(fname, sizeof(fname), "%s/net_cls.classid", net_cls_cgroup_path);
LOG_D("Setting '%s' to '%s'", fname, net_cls_classid_str);
if (!utilWriteBufToFile(
fname, net_cls_classid_str, strlen(net_cls_classid_str), O_WRONLY | O_CLOEXEC)) {
if (!utilWriteBufToFile(fname, net_cls_classid_str, strlen(net_cls_classid_str),
O_WRONLY | O_CLOEXEC)) {
LOG_E("Could not update net_cls cgroup classid");
return false;
}

View File

@ -261,7 +261,7 @@ void cmdlineLogParams(struct nsjconf_t* nsjconf)
}
}
__rlim64_t cmdlineParseRLimit(int res, const char* optarg, unsigned long mul)
uint64_t cmdlineParseRLimit(int res, const char* optarg, unsigned long mul)
{
if (strcasecmp(optarg, "inf") == 0) {
return RLIM64_INFINITY;
@ -281,7 +281,7 @@ __rlim64_t cmdlineParseRLimit(int res, const char* optarg, unsigned long mul)
"provided)",
res, optarg);
}
__rlim64_t val = strtoull(optarg, NULL, 0) * mul;
uint64_t val = strtoull(optarg, NULL, 0) * mul;
if (val == ULLONG_MAX && errno != 0) {
PLOG_F("strtoul('%s', 0)", optarg);
}

View File

@ -29,7 +29,7 @@
#include "nsjail.h"
__rlim64_t cmdlineParseRLimit(int res, const char* optarg, unsigned long mul);
uint64_t cmdlineParseRLimit(int res, const char* optarg, unsigned long mul);
void cmdlineLogParams(struct nsjconf_t* nsjconf);
bool cmdlineParse(int argc, char* argv[], struct nsjconf_t* nsjconf);

View File

@ -123,13 +123,13 @@ struct nsjconf_t {
bool keep_env;
bool keep_caps;
bool disable_no_new_privs;
__rlim64_t rl_as;
__rlim64_t rl_core;
__rlim64_t rl_cpu;
__rlim64_t rl_fsize;
__rlim64_t rl_nofile;
__rlim64_t rl_nproc;
__rlim64_t rl_stack;
uint64_t rl_as;
uint64_t rl_core;
uint64_t rl_cpu;
uint64_t rl_fsize;
uint64_t rl_nofile;
uint64_t rl_nproc;
uint64_t rl_stack;
unsigned long personality;
bool clone_newnet;
bool clone_newuser;