* [Qemu-devel] [PATCH 2/2] qemu-ga: Fix missing environ declaration
2012-05-23 18:48 [Qemu-devel] [PATCH 1.1 0/2]: qemu-ga: fix build on openbsd Luiz Capitulino
@ 2012-05-23 18:48 ` Luiz Capitulino
0 siblings, 0 replies; 4+ messages in thread
From: Luiz Capitulino @ 2012-05-23 18:48 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori, eblake, mdroth, afaerber, kraxel
Commit 3674838cd05268954bb6473239cd7f700a79bf0f uses the environ global
variable, but is relying on environ to be declared somewhere else.
This worked for me because on F16 environ is declared in <unistd.h>, but
that doesn't happen in OpenBSD for example, causing a build failure.
This commit fixes the build error by declaring environ if it hasn't
being declared yet.
Also fixes a build warning due to a missing <sys/wait.h> include.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
qga/commands-posix.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 7664be1..dab3bf9 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -14,12 +14,17 @@
#include <glib.h>
#include <sys/types.h>
#include <sys/ioctl.h>
+#include <sys/wait.h>
#include "qga/guest-agent-core.h"
#include "qga-qmp-commands.h"
#include "qerror.h"
#include "qemu-queue.h"
#include "host-utils.h"
+#ifndef CONFIG_HAS_ENVIRON
+extern char **environ;
+#endif
+
#if defined(__linux__)
#include <mntent.h>
#include <linux/fs.h>
@@ -27,7 +32,6 @@
#include <arpa/inet.h>
#include <sys/socket.h>
#include <net/if.h>
-#include <sys/wait.h>
#if defined(__linux__) && defined(FIFREEZE)
#define CONFIG_FSFREEZE
--
1.7.9.2.384.g4a92a
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PULL 1.1] qemu-ga build fix for OpenBSD
@ 2012-05-24 18:52 Michael Roth
2012-05-24 18:52 ` [Qemu-devel] [PATCH 1/2] configure: check if environ is declared Michael Roth
2012-05-24 18:52 ` [Qemu-devel] [PATCH 2/2] qemu-ga: Fix missing environ declaration Michael Roth
0 siblings, 2 replies; 4+ messages in thread
From: Michael Roth @ 2012-05-24 18:52 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori, lcapitulino
The following changes since commit aeb29b6459cb9496b38c820f3faff64cf2369d0d:
audio: Always call fini on exit (2012-05-24 19:35:27 +0400)
are available in the git repository at:
git://github.com/mdroth/qemu.git qga-pull-5-24-12
Luiz Capitulino (2):
configure: check if environ is declared
qemu-ga: Fix missing environ declaration
configure | 19 +++++++++++++++++++
qga/commands-posix.c | 6 +++++-
2 files changed, 24 insertions(+), 1 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 1/2] configure: check if environ is declared
2012-05-24 18:52 [Qemu-devel] [PULL 1.1] qemu-ga build fix for OpenBSD Michael Roth
@ 2012-05-24 18:52 ` Michael Roth
2012-05-24 18:52 ` [Qemu-devel] [PATCH 2/2] qemu-ga: Fix missing environ declaration Michael Roth
1 sibling, 0 replies; 4+ messages in thread
From: Michael Roth @ 2012-05-24 18:52 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori, lcapitulino
From: Luiz Capitulino <lcapitulino@redhat.com>
Some systems may declare environ automatically, others don't. Check for it.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
configure | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
index b55a792..1f338f8 100755
--- a/configure
+++ b/configure
@@ -2831,6 +2831,21 @@ if compile_prog "" "" ; then
linux_magic_h=yes
fi
+########################################
+# check if environ is declared
+
+has_environ=no
+cat > $TMPC << EOF
+#include <unistd.h>
+int main(void) {
+ environ = environ;
+ return 0;
+}
+EOF
+if compile_prog "" "" ; then
+ has_environ=yes
+fi
+
##########################################
# End of CC checks
# After here, no more $cc or $ld runs
@@ -3342,6 +3357,10 @@ if test "$linux_magic_h" = "yes" ; then
echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
fi
+if test "$has_environ" = "yes" ; then
+ echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
+fi
+
# USB host support
case "$usb" in
linux)
--
1.7.4.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 2/2] qemu-ga: Fix missing environ declaration
2012-05-24 18:52 [Qemu-devel] [PULL 1.1] qemu-ga build fix for OpenBSD Michael Roth
2012-05-24 18:52 ` [Qemu-devel] [PATCH 1/2] configure: check if environ is declared Michael Roth
@ 2012-05-24 18:52 ` Michael Roth
1 sibling, 0 replies; 4+ messages in thread
From: Michael Roth @ 2012-05-24 18:52 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori, lcapitulino
From: Luiz Capitulino <lcapitulino@redhat.com>
Commit 3674838cd05268954bb6473239cd7f700a79bf0f uses the environ global
variable, but is relying on environ to be declared somewhere else.
This worked for me because on F16 environ is declared in <unistd.h>, but
that doesn't happen in OpenBSD for example, causing a build failure.
This commit fixes the build error by declaring environ if it hasn't
being declared yet.
Also fixes a build warning due to a missing <sys/wait.h> include.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
qga/commands-posix.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 7664be1..dab3bf9 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -14,12 +14,17 @@
#include <glib.h>
#include <sys/types.h>
#include <sys/ioctl.h>
+#include <sys/wait.h>
#include "qga/guest-agent-core.h"
#include "qga-qmp-commands.h"
#include "qerror.h"
#include "qemu-queue.h"
#include "host-utils.h"
+#ifndef CONFIG_HAS_ENVIRON
+extern char **environ;
+#endif
+
#if defined(__linux__)
#include <mntent.h>
#include <linux/fs.h>
@@ -27,7 +32,6 @@
#include <arpa/inet.h>
#include <sys/socket.h>
#include <net/if.h>
-#include <sys/wait.h>
#if defined(__linux__) && defined(FIFREEZE)
#define CONFIG_FSFREEZE
--
1.7.4.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-24 18:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-24 18:52 [Qemu-devel] [PULL 1.1] qemu-ga build fix for OpenBSD Michael Roth
2012-05-24 18:52 ` [Qemu-devel] [PATCH 1/2] configure: check if environ is declared Michael Roth
2012-05-24 18:52 ` [Qemu-devel] [PATCH 2/2] qemu-ga: Fix missing environ declaration Michael Roth
-- strict thread matches above, loose matches on Subject: below --
2012-05-23 18:48 [Qemu-devel] [PATCH 1.1 0/2]: qemu-ga: fix build on openbsd Luiz Capitulino
2012-05-23 18:48 ` [Qemu-devel] [PATCH 2/2] qemu-ga: Fix missing environ declaration Luiz Capitulino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).