[libvirt] [PATCH v3] util: systemd: Define MSG_NOSIGNAL if needed

The symbol being missing has been reported as causing build failures on OS X. If it's not already defined, define it to zero so that it won't have any effect. --- Changes from v2: * define MSG_NOSIGNAL to zero if not already defined instead of conditionally compiling the code depending on it src/util/virsystemd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 969cd68..7d6985b 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -41,6 +41,10 @@ VIR_LOG_INIT("util.systemd"); +#ifndef MSG_NOSIGNAL +# define MSG_NOSIGNAL 0 +#endif + static void virSystemdEscapeName(virBufferPtr buf, const char *name) { -- 2.7.4

On 20 Jul 2016, at 14:46, Andrea Bolognani <abologna@redhat.com> wrote:
The symbol being missing has been reported as causing build failures on OS X. If it's not already defined, define it to zero so that it won't have any effect. --- Changes from v2:
* define MSG_NOSIGNAL to zero if not already defined instead of conditionally compiling the code depending on it
src/util/virsystemd.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 969cd68..7d6985b 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -41,6 +41,10 @@
VIR_LOG_INIT("util.systemd");
+#ifndef MSG_NOSIGNAL +# define MSG_NOSIGNAL 0 +#endif + static void virSystemdEscapeName(virBufferPtr buf, const char *name) { -- 2.7.4
This compiles fine on OSX too. :) One niggle with it though... this is what is looks like in context: ******************************************************************* ... #include "virerror.h" #include "virfile.h" #define VIR_FROM_THIS VIR_FROM_SYSTEMD VIR_LOG_INIT("util.systemd"); #ifndef MSG_NOSIGNAL # define MSG_NOSIGNAL 0 #endif static void virSystemdEscapeName(virBufferPtr buf, const char *name) { static const char hextable[16] = "0123456789abcdef"; #define ESCAPE(c) ... ******************************************************************* Isn't it kind of crying out for a useful comment, so the next person looking through this code has a good chance to understand why it's there? ;) Maybe something like: /* OSX is missing MSG_NOSIGNAL, so we define it here to avoid * failure during building. */ :) + 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, Jul 20, 2016 at 03:11:51PM +0100, Justin Clift wrote:
On 20 Jul 2016, at 14:46, Andrea Bolognani <abologna@redhat.com> wrote:
The symbol being missing has been reported as causing build failures on OS X. If it's not already defined, define it to zero so that it won't have any effect. --- Changes from v2:
* define MSG_NOSIGNAL to zero if not already defined instead of conditionally compiling the code depending on it
src/util/virsystemd.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 969cd68..7d6985b 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -41,6 +41,10 @@
VIR_LOG_INIT("util.systemd");
+#ifndef MSG_NOSIGNAL +# define MSG_NOSIGNAL 0 +#endif + static void virSystemdEscapeName(virBufferPtr buf, const char *name) { -- 2.7.4
This compiles fine on OSX too. :)
One niggle with it though... this is what is looks like in context:
******************************************************************* ... #include "virerror.h" #include "virfile.h"
#define VIR_FROM_THIS VIR_FROM_SYSTEMD
VIR_LOG_INIT("util.systemd");
#ifndef MSG_NOSIGNAL # define MSG_NOSIGNAL 0 #endif
static void virSystemdEscapeName(virBufferPtr buf, const char *name) { static const char hextable[16] = "0123456789abcdef";
#define ESCAPE(c) ... *******************************************************************
Isn't it kind of crying out for a useful comment, so the next person looking through this code has a good chance to understand why it's there? ;)
Maybe something like:
/* OSX is missing MSG_NOSIGNAL, so we define it here to avoid * failure during building. */
Not really - it is pretty obvious what the code is doing so adding such a comment doesn't really add much value. 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 22 Jul 2016, at 10:13, Daniel P. Berrange <berrange@redhat.com> wrote:
On Wed, Jul 20, 2016 at 03:11:51PM +0100, Justin Clift wrote:
On 20 Jul 2016, at 14:46, Andrea Bolognani <abologna@redhat.com> wrote:
The symbol being missing has been reported as causing build failures on OS X. If it's not already defined, define it to zero so that it won't have any effect. --- Changes from v2:
* define MSG_NOSIGNAL to zero if not already defined instead of conditionally compiling the code depending on it
src/util/virsystemd.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 969cd68..7d6985b 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -41,6 +41,10 @@
VIR_LOG_INIT("util.systemd");
+#ifndef MSG_NOSIGNAL +# define MSG_NOSIGNAL 0 +#endif + static void virSystemdEscapeName(virBufferPtr buf, const char *name) { -- 2.7.4
This compiles fine on OSX too. :)
One niggle with it though... this is what is looks like in context:
******************************************************************* ... #include "virerror.h" #include "virfile.h"
#define VIR_FROM_THIS VIR_FROM_SYSTEMD
VIR_LOG_INIT("util.systemd");
#ifndef MSG_NOSIGNAL # define MSG_NOSIGNAL 0 #endif
static void virSystemdEscapeName(virBufferPtr buf, const char *name) { static const char hextable[16] = "0123456789abcdef";
#define ESCAPE(c) ... *******************************************************************
Isn't it kind of crying out for a useful comment, so the next person looking through this code has a good chance to understand why it's there? ;)
Maybe something like:
/* OSX is missing MSG_NOSIGNAL, so we define it here to avoid * failure during building. */
Not really - it is pretty obvious what the code is doing so adding such a comment doesn't really add much value.
No worries at all. :) + 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, Jul 20, 2016 at 03:46:56PM +0200, Andrea Bolognani wrote:
The symbol being missing has been reported as causing build failures on OS X. If it's not already defined, define it to zero so that it won't have any effect. --- Changes from v2:
* define MSG_NOSIGNAL to zero if not already defined instead of conditionally compiling the code depending on it
src/util/virsystemd.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 969cd68..7d6985b 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -41,6 +41,10 @@
VIR_LOG_INIT("util.systemd");
+#ifndef MSG_NOSIGNAL +# define MSG_NOSIGNAL 0 +#endif + static void virSystemdEscapeName(virBufferPtr buf, const char *name) {
ACK 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 :|

Daniel P. Berrange wrote:
On Wed, Jul 20, 2016 at 03:46:56PM +0200, Andrea Bolognani wrote:
The symbol being missing has been reported as causing build failures on OS X. If it's not already defined, define it to zero so that it won't have any effect. --- Changes from v2:
* define MSG_NOSIGNAL to zero if not already defined instead of conditionally compiling the code depending on it
src/util/virsystemd.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 969cd68..7d6985b 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -41,6 +41,10 @@
VIR_LOG_INIT("util.systemd");
+#ifndef MSG_NOSIGNAL +# define MSG_NOSIGNAL 0 +#endif + static void virSystemdEscapeName(virBufferPtr buf, const char *name) {
ACK
I pushed the patch to make sure it won't get lost and get into the upcoming release. Roman Bogorodskiy

On 26 Jul 2016, at 08:26, Andrea Bolognani <abologna@redhat.com> wrote:
On Tue, 2016-07-26 at 04:55 +0300, Roman Bogorodskiy wrote:
I pushed the patch to make sure it won't get lost and get into the upcoming release.
I was away for a few days, thanks for taking care of this :)
Thanks guys. :) + 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
participants (4)
-
Andrea Bolognani
-
Daniel P. Berrange
-
Justin Clift
-
Roman Bogorodskiy