Skip to contentSkip to conversation

containers/netns: Add missed definition for check_netns_enabled.c

PATCH In review Hangbin Liu 2 participants 2 messages Mar 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 containers/netns: Add missed definition for check_netns_enabled.c

CLONE_NEWNET and CLONE_NEWNS are defined in bit/sched.h, and need __USE_GNU defined first. Do the same as par_chld_ipv6.c and two_children_ns.c did, just define _GNU_SOURCE directly.

Also remove duplicate CLONE_NEWNET definition cause we won't run netns test if CLONE_NEWNET and CLONE_NEWNS are not defined.

---
 testcases/kernel/containers/libclone/libclone.h         | 4 ----
 testcases/kernel/containers/netns/check_netns_enabled.c | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)
testcases/kernel/containers/libclone/libclone.h +0 -4
index 9380cec..50e00f7 100644
@@ -73,10 +73,6 @@
 #define CLONE_NEWPID            0x20000000
 #endif
 
-#ifndef CLONE_NEWNET
-#define CLONE_NEWNET		0x40000000
-#endif
-
 extern int create_net_namespace(char *, char *);
 
 /*
testcases/kernel/containers/netns/check_netns_enabled.c +3 -0
index ab8ee2f..9c1d84a 100644
@@ -19,6 +19,9 @@
 * assume they are not enabled.  Kernels after that, check for -EINVAL
 * when trying to use CLONE_NEWNET and CLONE_NEWNS.
 ***************************************************************************/
+
+#define _GNU_SOURCE
+
 #include <stdio.h>
 #include <sched.h>
 #include "config.h"
Signature · 13 lines
1.8.1.4


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

Hi!

Quoted 18 lines

CLONE_NEWNET and CLONE_NEWNS are defined in bit/sched.h, and need __USE_GNU defined first. Do the same as par_chld_ipv6.c and two_children_ns.c did, just define _GNU_SOURCE directly.

Also remove duplicate CLONE_NEWNET definition cause we won't run netns test if CLONE_NEWNET and CLONE_NEWNS are not defined.

---
 testcases/kernel/containers/libclone/libclone.h         | 4 ----
 testcases/kernel/containers/netns/check_netns_enabled.c | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)
testcases/kernel/containers/libclone/libclone.h +0 -0
index 9380cec..50e00f7 100644

testcases/kernel/containers/libclone/libclone.h line 78

Quoted 6 lines
testcases/kernel/containers/libclone/libclone.h +0 -3
@@ -73,10 +73,6 @@
 #define CLONE_NEWPID            0x20000000
 #endif
 
-#ifndef CLONE_NEWNET
-#define CLONE_NEWNET		0x40000000
-#endif

The clone flags has been added to glibc-2.8 in

commit 0ab7632d38f52e2a540b3550f69ec0ed293c0cdb

Author: Ulrich Drepper <[email protected]>
Date:   Mon Mar 24 16:03:48 2008 +0000

* sysdeps/unix/sysv/linux/bits/sched.h: Add new CLONE_* flags,

remove CLONE_STOPPED.

And if I remeber right, we agreed that we should support at least 2.3.3 so that LTP builds on older enterprise distributions. So we should keep these ifdefs a bit longer. Or is there a good reason to remove it?

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list