pcp
[Top] [All Lists]

Re: [pcp] Protecting AF_UNIX Code

To: Dave Brolley <brolley@xxxxxxxxxx>
Subject: Re: [pcp] Protecting AF_UNIX Code
From: Nathan Scott <nathans@xxxxxxxxxx>
Date: Mon, 10 Jun 2013 19:08:10 -0400 (EDT)
Cc: PCP <pcp@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <51B6332A.90404@xxxxxxxxxx>
References: <51B6332A.90404@xxxxxxxxxx>
Reply-to: Nathan Scott <nathans@xxxxxxxxxx>
Thread-index: thAC0Q5S5YMK1uWdrcBkQfyzjyErHQ==
Thread-topic: Protecting AF_UNIX Code
Hi Dave,

----- Original Message -----
> Hi All,
> 
> I see that some existing parts of pcp are using '#if !defined(IS_MINGW)'
> to protect against unsupported plattforms for AF_UNIX (e.g.
> src/libpcp_pmda/src/open.c) where I have been using '#if
> defined(HAVE_SYS_UN_H)' (already implemented in our autoconf stuff).
> 
> We should probably be consistent. Is there a preference?

Strictly speaking the macro being used to protect conditional code
compilation should match up with the thing it is protecting.  So the
header #include should be protected by HAVE_SYS_UN_H and the use of
socket(AF_UNIX, ...) should be protected by HAVE_AF_UNIX.  "Someone"
(i.e. me) was a bit lazy on the latter and went with a pre-existing
platform check macro (IS_MINGW) rather than adding a new configure
macro.  We should fix it by adding HAVE_AF_UNIX and make use of that
in the body of the code IMO.  Also the error message in that library
code you mentioned should not refer to Windows explicitly, rather it
should say

    ..., "__pmdaOpenUnix: Not supported on this platform").

cheers.

--
Nathan

<Prev in Thread] Current Thread [Next in Thread>