Skip to contentSkip to conversation

patch for pipe() result handling

Qemu-devel Stuart Anderson 1 participant 1 message May 30, 2007

lore
Share & tools
lore
#0 lore raw

pipe(2) on MIPS does some funny, non-standard stuff with it's return data. This patch implments this unusual handling. Without this patch, bash closes it's own stdin by mistake and therefore exits immediately after presenting the prompt.

The LTP test results for the pipe() tests are improved with this patch as well.

Stuart

Stuart R. Anderson                               [email protected]
Network & Software Engineering                   http://www.netsweng.com/
1024D/37A79149:                                  0791 D3B8 9A4C 2CDC A31F
                                                 BD03 0A62 E534 37A7 9149
linux-user/syscall.c +5 -0
Index: qemu/linux-user/syscall.c
===================================================================
@@ -2916,8 +2916,13 @@
             int host_pipe[2];
             ret = get_errno(pipe(host_pipe));
             if (!is_error(ret)) {
+#if defined(TARGET_MIPS)
+		((CPUMIPSState*)cpu_env)->gpr[3] = host_pipe[1];
+		ret = host_pipe[0];
+#else
                 tput32(arg1, host_pipe[0]);
                 tput32(arg1 + 4, host_pipe[1]);
+#endif
             }
         }
         break;