diff mbox series

[v4,1/3] osdep: add wait.h compat macros

Message ID 1527186303-192100-2-git-send-email-mst@redhat.com
State New
Headers show
Series libqtest: verify QEMU exit status | expand

Commit Message

Michael S. Tsirkin May 24, 2018, 6:25 p.m. UTC
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 | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Markus Armbruster June 14, 2018, 12:56 p.m. UTC | #1
"Michael S. Tsirkin" <mst@redhat.com> writes:

> 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.

Sorry to nitpick, but you're not doing "exactly this", you're providing
a stub:

> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  include/qemu/osdep.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index 4165806..afc28e5 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -108,6 +108,16 @@ extern int daemon(int, int);
>  #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
>   * at compile-time.  You may comment out these safety checks if you

Suggest to drop the last sentence from the comment, and have the commit
message state you're providing a stub.
Peter Maydell June 14, 2018, 1:02 p.m. UTC | #2
On 14 June 2018 at 13:56, Markus Armbruster <armbru@redhat.com> wrote:
> Suggest to drop the last sentence from the comment, and have the commit
> message state you're providing a stub.

This patch is already in upstream, commit 28012e190e68...

thanks
-- PMM
diff mbox series

Patch

diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 4165806..afc28e5 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -108,6 +108,16 @@  extern int daemon(int, int);
 #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
  * at compile-time.  You may comment out these safety checks if you