[libvirt] [PATCH v2] configure: Check for MSG_NOSIGNAL availability

The symbol being missing has been reported as causing build failures on OS X. Check for its availability before using it. --- Changes from v1: * don't unnecessarily check for availability at configure time (thanks J��n) src/util/virsystemd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 969cd68..81ee538 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -482,7 +482,7 @@ int virSystemdTerminateMachine(const char *name) void virSystemdNotifyStartup(void) { -#ifdef HAVE_SYS_UN_H +#if defined(HAVE_SYS_UN_H) && defined(MSG_NOSIGNAL) const char *path; const char *msg = "READY=1"; int fd; @@ -526,7 +526,7 @@ virSystemdNotifyStartup(void) VIR_WARN("Failed to notify systemd"); VIR_FORCE_CLOSE(fd); -#endif /* HAVE_SYS_UN_H */ +#endif /* defined(HAVE_SYS_UN_H) && defined(MSG_NOSIGNAL) */ } static int -- 2.7.4

On Wed, Jul 20, 2016 at 03:16:35PM +0200, Andrea Bolognani wrote:
The symbol being missing has been reported as causing build failures on OS X. Check for its availability before using it. --- Changes from v1:
* don't unnecessarily check for availability at configure time (thanks Ján)
src/util/virsystemd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 969cd68..81ee538 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -482,7 +482,7 @@ int virSystemdTerminateMachine(const char *name) void virSystemdNotifyStartup(void) { -#ifdef HAVE_SYS_UN_H +#if defined(HAVE_SYS_UN_H) && defined(MSG_NOSIGNAL) const char *path; const char *msg = "READY=1"; int fd; @@ -526,7 +526,7 @@ virSystemdNotifyStartup(void) VIR_WARN("Failed to notify systemd");
VIR_FORCE_CLOSE(fd); -#endif /* HAVE_SYS_UN_H */ +#endif /* defined(HAVE_SYS_UN_H) && defined(MSG_NOSIGNAL) */
IMHO it'd be nicer to just do #ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0 #endif as it avoids creating ever more compicated conditional blocks around the code. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Wed, 2016-07-20 at 14:19 +0100, Daniel P. Berrange wrote:
On Wed, Jul 20, 2016 at 03:16:35PM +0200, Andrea Bolognani wrote:
The symbol being missing has been reported as causing build failures on OS X. Check for its availability before using it. --- Changes from v1: * don't unnecessarily check for availability at configure time (thanks Ján) src/util/virsystemd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 969cd68..81ee538 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -482,7 +482,7 @@ int virSystemdTerminateMachine(const char *name) void virSystemdNotifyStartup(void) { -#ifdef HAVE_SYS_UN_H +#if defined(HAVE_SYS_UN_H) && defined(MSG_NOSIGNAL) const char *path; const char *msg = "READY=1"; int fd; @@ -526,7 +526,7 @@ virSystemdNotifyStartup(void) VIR_WARN("Failed to notify systemd"); VIR_FORCE_CLOSE(fd); -#endif /* HAVE_SYS_UN_H */ +#endif /* defined(HAVE_SYS_UN_H) && defined(MSG_NOSIGNAL) */ IMHO it'd be nicer to just do #ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0 #endif as it avoids creating ever more compicated conditional blocks around the code.
So pretty much the patch that was proposed initially, then ;) v3 coming right up! -- Andrea Bolognani / Red Hat / Virtualization

On 20 Jul 2016, at 14:38, Andrea Bolognani <abologna@redhat.com> wrote:
On Wed, 2016-07-20 at 14:19 +0100, Daniel P. Berrange wrote:
On Wed, Jul 20, 2016 at 03:16:35PM +0200, Andrea Bolognani wrote:
The symbol being missing has been reported as causing build failures on OS X. Check for its availability before using it. --- Changes from v1:
* don't unnecessarily check for availability at configure time (thanks Ján)
src/util/virsystemd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 969cd68..81ee538 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -482,7 +482,7 @@ int virSystemdTerminateMachine(const char *name) void virSystemdNotifyStartup(void) { -#ifdef HAVE_SYS_UN_H +#if defined(HAVE_SYS_UN_H) && defined(MSG_NOSIGNAL) const char *path; const char *msg = "READY=1"; int fd; @@ -526,7 +526,7 @@ virSystemdNotifyStartup(void) VIR_WARN("Failed to notify systemd");
VIR_FORCE_CLOSE(fd); -#endif /* HAVE_SYS_UN_H */ +#endif /* defined(HAVE_SYS_UN_H) && defined(MSG_NOSIGNAL) */
IMHO it'd be nicer to just do
#ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0 #endif
as it avoids creating ever more compicated conditional blocks around the code.
So pretty much the patch that was proposed initially, then ;)
v3 coming right up!
Trivial side thought... since this isn't a "configure" patch any more, should the title for the patch be adjusted? ;) + Justin -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi

On Wed, 2016-07-20 at 14:49 +0100, Justin Clift wrote:
v3 coming right up! Trivial side thought... since this isn't a "configure" patch any more, should the title for the patch be adjusted? ;)
Definitely! Luckily, I realized that on my own before sending out v3 and making a fool of myself a second time ;) -- Andrea Bolognani / Red Hat / Virtualization
participants (3)
-
Andrea Bolognani
-
Daniel P. Berrange
-
Justin Clift