Skip to contentSkip to conversation

zeromq: don't use fork() on noMMU platforms

PATCH New Jerzy Grzegorek 2 participants 2 messages Apr 26, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 zeromq: don't use fork() on noMMU platforms

Fixes:
http://autobuild.buildroot.net/results/439/439df2ad4482d08f295dbc40b2e88bf9167a7794/

---
Changes v1 -> v2:
- change subject
- use an AC_CHECK_FUNCS(fork) test to build conditionally test_fork

 package/zeromq/zeromq-01-no-mmu.patch |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 package/zeromq/zeromq-01-no-mmu.patch
package/zeromq/zeromq-01-no-mmu.patch new file +20 -0
new file mode 100644
index 0000000..0e0a4ca
@@ -0,0 +1,20 @@
+Don't use fork() on noMMU platforms
+
+Signed-off-by: Jerzy Grzegorek <[email protected]>
+
+diff -rupN a/tests/test_fork.cpp b/tests/test_fork.cpp
+--- a/tests/test_fork.cpp	2013-11-13 18:57:50.000000000 +0100
++++ b/tests/test_fork.cpp	2014-04-24 08:57:01.000000000 +0200
+@@ -35,7 +35,11 @@ int main (void)
+     int rc = zmq_bind (pull, address);
+     assert (rc == 0);
+ 
+-    int pid = fork ();
++#ifdef HAVE_FORK
++    int pid = fork();
++#else
++    int pid = vfork();
++#endif
+     if (pid == 0) {
+         //  Child process
+         //  Immediately close parent sockets and context
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/1 zeromq: don't use fork() on noMMU platforms

Dear Jerzy Grzegorek,

Quoted 6 lines · Jerzy Grzegorek

+- int pid = fork ();
++#ifdef HAVE_FORK
++ int pid = fork();
++#else
++ int pid = vfork();
++#endif

Are you sure the child immediately does an exec() ? vfork() is not equivalent to fork(), so one cannot be blindly replaced by the other. Since the whole test is dedicated to testing fork, I think it doesn't make sense to build it. So, your previous patch was better, it is just that your previous patch was completely removing the build of test_fork, while it should be conditional on whether the platform implements fork() or not.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com