containers: Use raw setns syscall for versions of glibc that don't include it
PATCH 1/1 containers: Use raw setns syscall for versions of glibc that don't include it
The setns() system call was added to glibc in version 2.14. On systems with lower version glic, like RHEL6.6 glibc 2.12, ltp will build failed with error "userns04.c:58: undefined reference to `setns'". Use ltp_syscall to make build pass.
Signed-off-by Hangbin Liu <[email protected]>
--- testcases/kernel/containers/userns/userns_helper.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
testcases/kernel/containers/userns/userns_helper.h +10 -0
@@ -15,6 +15,16 @@#include "test.h" #include "safe_macros.h" +/* +* Use raw setns syscall for versions of glibc that don't include it +*/ +#if __GLIBC__ <=2 && __GLIBC_MINOR__ <14 +int setns (int fd,int nstype) +{ +return ltp_syscall (__NR_setns, fd, nstype); +} +#endif +static int dummy_child (void *v) { (void ) v;
Signature · 13 lines
1.9.3 ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi!
Quoted 7 lines
testcases/kernel/containers/userns/userns_helper.h +0
-0@@ -15,6 +15,16 @@#include "test.h" #include "safe_macros.h"
testcases/kernel/containers/userns/userns_helper.h line 26
Quoted 10 lines
testcases/kernel/containers/userns/userns_helper.h +9
-0+/* +* Use raw setns syscall for versions of glibc that don't include it +*/ +#if __GLIBC__ <=2 && __GLIBC_MINOR__ <14 +int setns (int fd,int nstype) +{ +return ltp_syscall (__NR_setns, fd, nstype); +} +#endif
I would rather see this as configure check. Simple AC_CHECK_FUNCS([setns]) would do, then we can use #ifndef HAVE_SETNS in the source after we include config.h.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list