[lxc-devel] [lxc/master] Fix compilation on toolchain without prlimit
ffontaine on Github
lxc-bot at linuxcontainers.org
Thu Nov 2 15:16:35 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 484 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171102/fde2a812/attachment.bin>
-------------- next part --------------
From 2e113ffdc38a4f1968e64c8e487a123dd912f4c0 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice at gmail.com>
Date: Thu, 2 Nov 2017 16:00:33 +0100
Subject: [PATCH] Fix compilation on toolchain without prlimit
Some toolchains which are not bionic like uclibc does not support
prlimit or prlimit64. In this case, return an error.
Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
---
src/lxc/conf.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 44d978430..f7f591ac5 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -2399,10 +2399,15 @@ int setup_resource_limits(struct lxc_list *limits, pid_t pid) {
return -1;
}
+#if IS_BIONIC || HAVE_PRLIMIT
if (prlimit(pid, resid, &lim->limit, NULL) != 0) {
ERROR("failed to set limit %s: %s", lim->resource, strerror(errno));
return -1;
}
+#else
+ ERROR("Cannot set limit %s as prlimit is missing", lim->resource);
+ return -1;
+#endif
}
return 0;
}
More information about the lxc-devel
mailing list