containers/netns:parameters are not correct when calling, crtchild() function
PATCH v2 1/1 containers/netns:parameters are not correct when calling, crtchild() function
The numbers of parameters for crtchild() function which called in two_children_ns.c and par_chld_ipv6.c is not correct.And it will make the child process to be a zombie process.
And also move the definition of the function to the header file(common.h)
--- testcases/kernel/containers/libclone/libclone.h | 2 - testcases/kernel/containers/netns/common.c | 18 +------- testcases/kernel/containers/netns/common.h | 47 ++++++++++++++++++++ .../kernel/containers/netns/create_container.c | 2 +- testcases/kernel/containers/netns/crtchild.c | 2 +- .../kernel/containers/netns/crtchild_delchild.c | 2 +- testcases/kernel/containers/netns/par_chld_ftp.c | 2 +- testcases/kernel/containers/netns/par_chld_ipv6.c | 5 +-- testcases/kernel/containers/netns/sysfsview.c | 2 +- .../kernel/containers/netns/two_children_ns.c | 5 +-- 10 files changed, 57 insertions(+), 30 deletions(-)
create mode 100644 testcases/kernel/containers/netns/common.h
(quoted diff) +0 -0
b/testcases/kernel/containers/libclone/libclone.h
index 9380cec..6a2d66d 100644
testcases/kernel/containers/libclone/libclone.h +0 -2
@@ -77,8 +77,6 @@#define CLONE_NEWNET 0x40000000#endif -extern int create_net_namespace (char *,char *); -/* * Run fn1 in a unshared environmnent, and fn2 in the original context * Fn2 may be NULL.
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/common.c
index 291aeb7..67e1a2e 100644
testcases/kernel/containers/netns/common.c +1 -17
@@ -26,23 +26,7 @@#define _GNU_SOURCE -#include <sys/utsname.h> -#include <sched.h> -#include <stdio.h> -#include <stdlib.h> -#include <sys/syscall.h> -#include <unistd.h> -#include <signal.h> -#include <string.h> -#include <errno.h> -#include <libgen.h> -#include <fcntl.h> -#include <inttypes.h> -#include <sys/types.h> -#include <sys/wait.h> -#include "libclone.h" -#include "test.h" -#include "config.h" +#include "common.h" static int child_fn (void *c1);
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/common.h
new file mode 100644
index 0000000..c769a7f
testcases/kernel/containers/netns/common.h new file +13 -0
@@ -0,0 +1,47 @@ +/* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +* the GNU General Public License for more details. +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
+* +***************************************************************************/ +/*========================================================================= +* This testcase creates the network namespace.
+* It creates veth pair veth8 & veth9. Also assigns IP addresses to the childNS.
+* Also it starts the sshd daemon @ port 7890
+*
+* Scripts Used: parentns.sh childns.sh
+*
+* Author: Veerendra <[email protected]>
+=========================================================================*/ +
+
+#include <sys/utsname.h>
+#include <sched.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <signal.h>
+#include <string.h>
+#include <errno.h>
+#include <libgen.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include "libclone.h"
+#include "test.h"
+#include "config.h"
+
+int crtchild(char *s1, char *s2);
+
+int create_net_namespace(char *p1, char *c1);
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/create_container.c index 8622153..ad74e4f 100644
testcases/kernel/containers/netns/create_container.c +0 -0
@@ -27,7 +27,7 @@* Author: Sudhir Kumar <[email protected]> 26/08/2008 *
============================================================================*/
-#include "libclone.h"
+#include "common.h"
const char *TCID = "create_container";
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/crtchild.c
index 7b0d43a..d2769c7 100644
testcases/kernel/containers/netns/crtchild.c +0 -0
@@ -26,7 +26,7 @@* 31/07/2008 *
=============================================================================*/
-#include "libclone.h"
+#include "common.h"
const char *TCID = "crtchild";
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/crtchild_delchild.c index 4d37b6f..6b82997 100644
testcases/kernel/containers/netns/crtchild_delchild.c +0 -0
@@ -29,7 +29,7 @@* 31/07/2008 *
=========================================================================*/
-#include "libclone.h"
+#include "common.h"
const char *TCID = "crtchild_delchild";
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/par_chld_ftp.c index 4b9ac71..605be19 100644
testcases/kernel/containers/netns/par_chld_ftp.c +0 -0
@@ -26,7 +26,7 @@* 31/07/2008 *
=============================================================================*/
-#include "libclone.h"
+#include "common.h"
const char *TCID = "par_chld_ftp";
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/par_chld_ipv6.c index f0d17ba..4d982bc 100644
testcases/kernel/containers/netns/par_chld_ipv6.c +2 -3
@@ -44,8 +44,7 @@#include <sys/wait.h> #include "test.h" #include "config.h" - -extern int crtchild (char *); +#include "common.h" char *TCID ="netns_ipv6" ;int TST_TOTAL =1 ;
@@ -95,7 +94,7 @@ int main()#else tst_resm (TCONF ,"System doesn't have unshare support" );#endif -return crtchild (child); +return crtchild (child,NULL ); }else {//parent
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/sysfsview.c
index b130973..f558f82 100644
testcases/kernel/containers/netns/sysfsview.c +1 -1
@@ -36,7 +36,7 @@#include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> -#include "libclone.h" +#include "common.h" const char *TCID ="sysfsview" ;
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/two_children_ns.c index 235d9c4..1abff54 100644
testcases/kernel/containers/netns/two_children_ns.c +2 -3
@@ -46,8 +46,7 @@#include "test.h" #include "libclone.h" #include "config.h" - -extern int crtchild (char *); +#include "common.h" char *TCID ="netns_2children" ;int TST_TOTAL =1 ;
@@ -109,7 +108,7 @@ int main() return ret; }#endif -return crtchild (child[i]); +return crtchild (child[i],NULL ); }else {//Parent
Signature · 12 lines
1.7.9.5 ------------------------------------------------------------------------------ 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/NeoTech _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi!
Quoted 51 lines
The numbers of parameters for
crtchild()function which called intwo_children_ns.candpar_chld_ipv6.cis not correct.And it will make the child process to be a zombie process.
And also move the definition of the function to the header file(common.h)Signed-off-by [email protected]--- testcases/kernel/containers/libclone/libclone.h | 2 - testcases/kernel/containers/netns/common.c | 18 +------- testcases/kernel/containers/netns/common.h | 47 ++++++++++++++++++++ .../kernel/containers/netns/create_container.c | 2 +- testcases/kernel/containers/netns/crtchild.c | 2 +- .../kernel/containers/netns/crtchild_delchild.c | 2 +- testcases/kernel/containers/netns/par_chld_ftp.c | 2 +- testcases/kernel/containers/netns/par_chld_ipv6.c | 5 +-- testcases/kernel/containers/netns/sysfsview.c | 2 +- .../kernel/containers/netns/two_children_ns.c | 5 +-- 10 files changed, 57 insertions(+), 30 deletions(-)create mode 100644
testcases/kernel/containers/netns/common.htestcases/kernel/containers/libclone/libclone.h +0
-2@@ -77,8 +77,6 @@#define CLONE_NEWNET 0x40000000#endif -extern int create_net_namespace (char *,char *); -/* * Run fn1 in a unshared environmnent, and fn2 in the original context * Fn2 may be NULL. testcases/kernel/containers/netns/common.c +0
-7@@ -26,23 +26,7 @@#define _GNU_SOURCE -#include <sys/utsname.h> -#include <sched.h> -#include <stdio.h> -#include <stdlib.h> -#include <sys/syscall.h> -#include <unistd.h> -#include <signal.h>
testcases/kernel/containers/netns/common.c line 45
Quoted 10 lines
testcases/kernel/containers/netns/common.c +0
-10-#include <string.h> -#include <errno.h> -#include <libgen.h> -#include <fcntl.h> -#include <inttypes.h> -#include <sys/types.h> -#include <sys/wait.h> -#include "libclone.h" -#include "test.h" -#include "config.h"
These should have stayed here, only headers that are needed for types used in the common.h header should be moved there (if I'm looking right theare are none in this case).
Quoted 31 lines
testcases/kernel/containers/netns/common.c +1
-0+#include "common.h" static int child_fn (void *c1);testcases/kernel/containers/netns/common.h new file +13
-0@@ -0,0 +1,47 @@ +/* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +* the GNU General Public License for more details. +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
testcases/kernel/containers/netns/common.h new file +5
-0+* +***************************************************************************/ +/*========================================================================= +* This testcase creates the network namespace. +* It creates veth pair veth8 & veth9. Also assigns IP addresses to the childNS.
testcases/kernel/containers/netns/common.h
Quoted 6 lines
testcases/kernel/containers/netns/common.h new file +6
-0+* Also it starts the sshd daemon @ port 7890 +* +* Scripts Used: parentns.sh childns.sh +* +* Author: Veerendra <[email protected]> +=========================================================================*/
I would omit this comment, it does not add any usefull information, just keep the license here.
Quoted 11 lines
testcases/kernel/containers/netns/common.h new file +11
-0+#include <sys/utsname.h> +#include <sched.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/syscall.h> +#include <unistd.h> +#include <signal.h> +#include <string.h> +#include <errno.h> +#include <libgen.h> +#include <fcntl.h>
testcases/kernel/containers/netns/common.h
Quoted 10 lines
testcases/kernel/containers/netns/common.h new file +10
-0+#include <inttypes.h> +#include <sys/types.h> +#include <sys/wait.h> +#include "libclone.h" +#include "test.h" +#include "config.h" + +int crtchild (char *s1,char *s2); + +int create_net_namespace (char *p1,char *c1);
You shoud add include guards around the header includes and prototypes.
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/NeoTech _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v3 1/1 containers/netns:parameters are not correct when calling, crtchild() function
The numbers of parameters for crtchild() function which called in two_children_ns.c and par_chld_ipv6.c is not correct.And it will make the child process to be a zombie process.
And also move the definition of the function to the header file(common.h)
--- testcases/kernel/containers/libclone/libclone.h | 2 -- testcases/kernel/containers/netns/common.c | 1 + testcases/kernel/containers/netns/common.h | 23 ++++++++++++++++++++ .../kernel/containers/netns/create_container.c | 2 +- testcases/kernel/containers/netns/crtchild.c | 2 +- .../kernel/containers/netns/crtchild_delchild.c | 2 +- testcases/kernel/containers/netns/par_chld_ftp.c | 2 +- testcases/kernel/containers/netns/par_chld_ipv6.c | 5 ++--- testcases/kernel/containers/netns/sysfsview.c | 2 +- .../kernel/containers/netns/two_children_ns.c | 5 ++--- 10 files changed, 33 insertions(+), 13 deletions(-)
create mode 100644 testcases/kernel/containers/netns/common.h
(quoted diff) +0 -0
b/testcases/kernel/containers/libclone/libclone.h
index 9380cec..6a2d66d 100644
testcases/kernel/containers/libclone/libclone.h +0 -2
@@ -77,8 +77,6 @@#define CLONE_NEWNET 0x40000000#endif -extern int create_net_namespace (char *,char *); -/* * Run fn1 in a unshared environmnent, and fn2 in the original context * Fn2 may be NULL.
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/common.c
index 291aeb7..6862700 100644
testcases/kernel/containers/netns/common.c +1 -0
@@ -43,6 +43,7 @@#include "libclone.h" #include "test.h" #include "config.h" +#include "common.h" static int child_fn (void *c1);
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/common.h
new file mode 100644
index 0000000..d7af403
testcases/kernel/containers/netns/common.h new file +13 -0
@@ -0,0 +1,23 @@ +/* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +* the GNU General Public License for more details. +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
+* +***************************************************************************/ +#ifndef _COMMON_H_
+#define _COMMON_H_
+
+int crtchild(char *s1, char *s2);
+
+int create_net_namespace(char *p1, char *c1);
+
+#endif/*_COMMON_H_*/
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/create_container.c index 8622153..ad74e4f 100644
testcases/kernel/containers/netns/create_container.c +0 -0
@@ -27,7 +27,7 @@* Author: Sudhir Kumar <[email protected]> 26/08/2008 *
============================================================================*/
-#include "libclone.h"
+#include "common.h"
const char *TCID = "create_container";
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/crtchild.c
index 7b0d43a..d2769c7 100644
testcases/kernel/containers/netns/crtchild.c +0 -0
@@ -26,7 +26,7 @@* 31/07/2008 *
=============================================================================*/
-#include "libclone.h"
+#include "common.h"
const char *TCID = "crtchild";
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/crtchild_delchild.c index 4d37b6f..6b82997 100644
testcases/kernel/containers/netns/crtchild_delchild.c +0 -0
@@ -29,7 +29,7 @@* 31/07/2008 *
=========================================================================*/
-#include "libclone.h"
+#include "common.h"
const char *TCID = "crtchild_delchild";
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/par_chld_ftp.c index 4b9ac71..605be19 100644
testcases/kernel/containers/netns/par_chld_ftp.c +0 -0
@@ -26,7 +26,7 @@* 31/07/2008 *
=============================================================================*/
-#include "libclone.h"
+#include "common.h"
const char *TCID = "par_chld_ftp";
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/par_chld_ipv6.c index f0d17ba..4d982bc 100644
testcases/kernel/containers/netns/par_chld_ipv6.c +2 -3
@@ -44,8 +44,7 @@#include <sys/wait.h> #include "test.h" #include "config.h" - -extern int crtchild (char *); +#include "common.h" char *TCID ="netns_ipv6" ;int TST_TOTAL =1 ;
@@ -95,7 +94,7 @@ int main()#else tst_resm (TCONF ,"System doesn't have unshare support" );#endif -return crtchild (child); +return crtchild (child,NULL ); }else {//parent
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/sysfsview.c
index b130973..f558f82 100644
testcases/kernel/containers/netns/sysfsview.c +1 -1
@@ -36,7 +36,7 @@#include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> -#include "libclone.h" +#include "common.h" const char *TCID ="sysfsview" ;
(quoted diff) +0 -0
b/testcases/kernel/containers/netns/two_children_ns.c index 235d9c4..1abff54 100644
testcases/kernel/containers/netns/two_children_ns.c +2 -3
@@ -46,8 +46,7 @@#include "test.h" #include "libclone.h" #include "config.h" - -extern int crtchild (char *); +#include "common.h" char *TCID ="netns_2children" ;int TST_TOTAL =1 ;
@@ -109,7 +108,7 @@ int main() return ret; }#endif -return crtchild (child[i]); +return crtchild (child[i],NULL ); }else {//Parent
Signature · 13 lines
1.7.9.5 ------------------------------------------------------------------------------ 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/NeoTech _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi!
Review
Quoted 8 lines
The numbers of parameters for
crtchild()function which called intwo_children_ns.candpar_chld_ipv6.cis not correct.And it will make the child process to be a zombie process.
And also move the definition of the function to the header file(common.h)(quoted diff) +2
-0+#ifndef _COMMON_H_ +#define _COMMON_H_
Identifiers starting with double underscore or with underscore and capital letter are reserved for glibc implementation. We should use something as COMMON_H or COMMON_H__ to be sure not to collide. But this is very minor.
Apart from this the patch has been corrupted, most likely line wrapped by your mail client. Have a look at:
https://www.kernel.org/doc/Documentation/email-clients.txt
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list