osdep: add wait.h compat macros
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 24 May 2018 18:09:52 +0000 (21:09 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 24 May 2018 18:14:11 +0000 (21:14 +0300)
Man page for WCOREDUMP says:

  WCOREDUMP(wstatus) returns true if the child produced a core dump.
  This macro should be employed only if WIFSIGNALED returned true.

  This  macro  is  not  specified  in POSIX.1-2001 and is not
  available on some UNIX implementations (e.g., AIX, SunOS).  Therefore,
  enclose its use inside #ifdef WCOREDUMP ... #endif.

Let's do exactly this.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
include/qemu/osdep.h

index 41658060a7a83953c5063e2dc88cb2275557b890..afc28e5903b70b7ddfd49b2eacb80f4c50690f9a 100644 (file)
@@ -107,6 +107,16 @@ extern int daemon(int, int);
 #include "glib-compat.h"
 #include "qemu/typedefs.h"
 
+/*
+ * According to waitpid man page:
+ * WCOREDUMP
+ *  This  macro  is  not  specified  in POSIX.1-2001 and is not
+ *  available on some UNIX implementations (e.g., AIX, SunOS).
+ *  Therefore, enclose its use inside #ifdef WCOREDUMP ... #endif.
+ */
+#ifndef WCOREDUMP
+#define WCOREDUMP(status) 0
+#endif
 /*
  * We have a lot of unaudited code that may fail in strange ways, or
  * even be a security risk during migration, if you disable assertions