linux-user: fix wait* syscall status returns

When calling wait4 or waitpid with a status pointer and WNOHANG, the
syscall can potentially not modify the status pointer input. Now if we
have guest code like:

  int status = 0;
  waitpid(pid, &status, WNOHANG);
  if (status)
     <breakage>

then we have to make sure that in case status did not change we actually
return the guest's initialized status variable instead of our own uninitialized.
We fail to do so today, as we proxy everything through an uninitialized status
variable which for me ended up always containing the last error code.

This patch fixes some test cases when building yast2-core in OBS for ARM.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
1 file changed
tree: 9fff1135d092844973fd391bb8696d6c520499de
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. docs/
  7. fpu/
  8. fsdev/
  9. gdb-xml/
  10. hw/
  11. include/
  12. libcacard/
  13. linux-headers/
  14. linux-user/
  15. net/
  16. pc-bios/
  17. qapi/
  18. qga/
  19. QMP/
  20. qom/
  21. roms/
  22. scripts/
  23. slirp/
  24. sysconfigs/
  25. target-alpha/
  26. target-arm/
  27. target-cris/
  28. target-i386/
  29. target-lm32/
  30. target-m68k/
  31. target-microblaze/
  32. target-mips/
  33. target-ppc/
  34. target-s390x/
  35. target-sh4/
  36. target-sparc/
  37. target-unicore32/
  38. target-xtensa/
  39. tcg/
  40. tests/
  41. trace/
  42. ui/
  43. .gitignore
  44. .gitmodules
  45. .mailmap
  46. a.out.h
  47. acl.c
  48. acl.h
  49. aes.c
  50. aes.h
  51. aio.c
  52. alpha-dis.c
  53. alpha.ld
  54. arch_init.c
  55. arch_init.h
  56. arm-dis.c
  57. arm-semi.c
  58. arm.ld
  59. async.c
  60. balloon.c
  61. balloon.h
  62. bitmap.c
  63. bitmap.h
  64. bitops.c
  65. bitops.h
  66. block-migration.c
  67. block-migration.h
  68. block.c
  69. block.h
  70. block_int.h
  71. blockdev.c
  72. blockdev.h
  73. bswap.h
  74. bt-host.c
  75. bt-host.h
  76. bt-vhci.c
  77. buffered_file.c
  78. buffered_file.h
  79. cache-utils.c
  80. cache-utils.h
  81. Changelog
  82. check-qdict.c
  83. check-qfloat.c
  84. check-qint.c
  85. check-qjson.c
  86. check-qlist.c
  87. check-qstring.c
  88. cmd.c
  89. cmd.h
  90. CODING_STYLE
  91. compatfd.c
  92. compatfd.h
  93. compiler.h
  94. config.h
  95. configure
  96. console.c
  97. console.h
  98. COPYING
  99. COPYING.LIB
  100. coroutine-gthread.c
  101. coroutine-ucontext.c
  102. coroutine-win32.c
  103. cpu-all.h
  104. cpu-common.h
  105. cpu-defs.h
  106. cpu-exec.c
  107. cpus.c
  108. cpus.h
  109. cris-dis.c
  110. cursor.c
  111. cursor_hidden.xpm
  112. cursor_left_ptr.xpm
  113. cutils.c
  114. def-helper.h
  115. device_tree.c
  116. device_tree.h
  117. dis-asm.h
  118. disas.c
  119. disas.h
  120. dma-helpers.c
  121. dma.h
  122. dyngen-exec.h
  123. elf.h
  124. envlist.c
  125. envlist.h
  126. error.c
  127. error.h
  128. error_int.h
  129. event_notifier.c
  130. event_notifier.h
  131. exec-all.h
  132. exec-memory.h
  133. exec-obsolete.h
  134. exec.c
  135. gdbstub.c
  136. gdbstub.h
  137. gen-icount.h
  138. HACKING
  139. hmp-commands.hx
  140. hmp.c
  141. hmp.h
  142. host-utils.c
  143. host-utils.h
  144. hppa-dis.c
  145. hppa.ld
  146. i386-dis.c
  147. i386.ld
  148. ia64-dis.c
  149. ia64.ld
  150. input.c
  151. int128.h
  152. iohandler.c
  153. ioport-user.c
  154. ioport.c
  155. ioport.h
  156. iorange.h
  157. iov.c
  158. iov.h
  159. json-lexer.c
  160. json-lexer.h
  161. json-parser.c
  162. json-parser.h
  163. json-streamer.c
  164. json-streamer.h
  165. kvm-all.c
  166. kvm-stub.c
  167. kvm.h
  168. libfdt_env.h
  169. LICENSE
  170. linux-aio.c
  171. m68k-dis.c
  172. m68k-semi.c
  173. m68k.ld
  174. main-loop.c
  175. main-loop.h
  176. MAINTAINERS
  177. Makefile
  178. Makefile.dis
  179. Makefile.hw
  180. Makefile.objs
  181. Makefile.target
  182. Makefile.user
  183. memory.c
  184. memory.h
  185. microblaze-dis.c
  186. migration-exec.c
  187. migration-fd.c
  188. migration-tcp.c
  189. migration-unix.c
  190. migration.c
  191. migration.h
  192. mips-dis.c
  193. mips.ld
  194. module.c
  195. module.h
  196. monitor.c
  197. monitor.h
  198. nbd.c
  199. nbd.h
  200. net.c
  201. net.h
  202. notify.c
  203. notify.h
  204. os-posix.c
  205. os-win32.c
  206. osdep.c
  207. osdep.h
  208. oslib-posix.c
  209. oslib-win32.c
  210. path.c
  211. pci-ids.txt
  212. pflib.c
  213. pflib.h
  214. poison.h
  215. posix-aio-compat.c
  216. ppc-dis.c
  217. ppc.ld
  218. ppc64.ld
  219. qapi-schema-guest.json
  220. qapi-schema-test.json
  221. qapi-schema.json
  222. qbool.c
  223. qbool.h
  224. qdict-test-data.txt
  225. qdict.c
  226. qdict.h
  227. qemu-aio.h
  228. qemu-barrier.h
  229. qemu-char.c
  230. qemu-char.h
  231. qemu-common.h
  232. qemu-config.c
  233. qemu-config.h
  234. qemu-coroutine-int.h
  235. qemu-coroutine-io.c
  236. qemu-coroutine-lock.c
  237. qemu-coroutine-sleep.c
  238. qemu-coroutine.c
  239. qemu-coroutine.h
  240. qemu-doc.texi
  241. qemu-error.c
  242. qemu-error.h
  243. qemu-file.h
  244. qemu-ga.c
  245. qemu-img-cmds.hx
  246. qemu-img.c
  247. qemu-img.texi
  248. qemu-io.c
  249. qemu-lock.h
  250. qemu-log.h
  251. qemu-nbd.c
  252. qemu-nbd.texi
  253. qemu-objects.h
  254. qemu-option.c
  255. qemu-option.h
  256. qemu-options-wrapper.h
  257. qemu-options.h
  258. qemu-options.hx
  259. qemu-os-posix.h
  260. qemu-os-win32.h
  261. qemu-progress.c
  262. qemu-queue.h
  263. qemu-sockets.c
  264. qemu-tech.texi
  265. qemu-thread-posix.c
  266. qemu-thread-posix.h
  267. qemu-thread-win32.c
  268. qemu-thread-win32.h
  269. qemu-thread.h
  270. qemu-timer-common.c
  271. qemu-timer.c
  272. qemu-timer.h
  273. qemu-tls.h
  274. qemu-tool.c
  275. qemu-x509.h
  276. qemu-xattr.h
  277. qemu.sasl
  278. qemu_socket.h
  279. qerror.c
  280. qerror.h
  281. qfloat.c
  282. qfloat.h
  283. qint.c
  284. qint.h
  285. qjson.c
  286. qjson.h
  287. qlist.c
  288. qlist.h
  289. qmp-commands.hx
  290. qmp.c
  291. qobject.h
  292. qstring.c
  293. qstring.h
  294. range.h
  295. readline.c
  296. readline.h
  297. README
  298. rules.mak
  299. s390-dis.c
  300. s390.ld
  301. savevm.c
  302. sh4-dis.c
  303. softmmu-semi.h
  304. softmmu_defs.h
  305. softmmu_exec.h
  306. softmmu_header.h
  307. softmmu_template.h
  308. sparc-dis.c
  309. sparc.ld
  310. sparc64.ld
  311. spice-qemu-char.c
  312. sysemu.h
  313. targphys.h
  314. tcg-runtime.c
  315. tci-dis.c
  316. tci.c
  317. test-coroutine.c
  318. test-qmp-commands.c
  319. test-qmp-input-visitor.c
  320. test-qmp-output-visitor.c
  321. thunk.c
  322. thunk.h
  323. TODO
  324. trace-events
  325. translate-all.c
  326. uboot_image.h
  327. usb-bsd.c
  328. usb-linux.c
  329. usb-redir.c
  330. usb-stub.c
  331. user-exec.c
  332. VERSION
  333. version.rc
  334. vgafont.h
  335. vl.c
  336. vmstate.h
  337. x86_64.ld
  338. xen-all.c
  339. xen-mapcache.c
  340. xen-mapcache.h
  341. xen-stub.c
  342. xtensa-semi.c