From eecae14724b64d43f9a44b9b4e69143961c201a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 27 May 2012 17:02:20 +0200 Subject: [PATCH 1/2] qemu-ga: Fix use of environ on Darwin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use _NSGetEnviron() helper to access the environment. Signed-off-by: Andreas Färber Cc: Charlie Somerville Signed-off-by: Michael Roth --- qga/commands-posix.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index dab3bf9c98..4a71c27c4a 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -22,8 +22,13 @@ #include "host-utils.h" #ifndef CONFIG_HAS_ENVIRON +#ifdef __APPLE__ +#include +#define environ (*_NSGetEnviron()) +#else extern char **environ; #endif +#endif #if defined(__linux__) #include From 9e2fa418fbe71dd472fe5a9cd89ca26d5b594920 Mon Sep 17 00:00:00 2001 From: Michael Roth Date: Tue, 29 May 2012 10:08:50 -0500 Subject: [PATCH 2/2] qemu-ga: avoid blocking on atime update when reading /etc/mtab Currently we re-read/re-process /etc/mtab to get an updated list of mounts when guest-fsfreeze-thaw is called. This can cause an atime update on /etc/mtab, which will block if we're in a frozen state. Instead, use /proc's version of mtab, which may not be up-to-date with options passed via -o remount, but is compatible for our use cases since we only care about the filesystem type. Reported-by: Matsuda, Daiki Signed-off-by: Michael Roth --- qga/commands-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 4a71c27c4a..00d035da95 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -345,7 +345,7 @@ static int guest_fsfreeze_build_mount_list(GuestFsfreezeMountList *mounts) { struct mntent *ment; GuestFsfreezeMount *mount; - char const *mtab = MOUNTED; + char const *mtab = "/proc/self/mounts"; FILE *fp; fp = setmntent(mtab, "r");