Skip to content

Instantly share code, notes, and snippets.

@shulima
Created March 25, 2015 22:30
Show Gist options
  • Save shulima/3ca0eed701cc27bfbc71 to your computer and use it in GitHub Desktop.
Save shulima/3ca0eed701cc27bfbc71 to your computer and use it in GitHub Desktop.
SOCK_* defines
diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
index aaa8501..7ca56cd 100644
--- a/src/launch-libvirt.c
+++ b/src/launch-libvirt.c
@@ -28,6 +28,7 @@
#include <grp.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/un.h>
#include <sys/wait.h>
#include <assert.h>
#include <string.h>
@@ -57,6 +58,17 @@
#include "guestfs-internal-actions.h"
#include "guestfs_protocol.h"
+/* Fixes for Mac OS X */
+#if defined __APPLE__ && defined __MACH__
+#ifndef SOCK_CLOEXEC
+# define SOCK_CLOEXEC O_CLOEXEC
+#endif
+#ifndef SOCK_NONBLOCK
+# define SOCK_NONBLOCK O_NONBLOCK
+#endif
+#endif
+/* End of fixes for Mac OS X */
+
/* Check minimum required version of libvirt. The libvirt backend
* is new and not the default, so we can get away with forcing
* people who want to try it to have a reasonably new version of
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment