Defining _DBUS_POLL* in dbus-sysdeps.h

Schmottlach, Glenn GSchmott at harmanbecker.com
Fri Nov 7 13:01:22 PST 2008


I'm not sure I follow you here. Looking at the top of dbus-sysdeps.h I
see the following:

/* AIX sys/poll.h does #define events reqevents, and other
 * wonderousness, so must include sys/poll before declaring
 * DBusPollFD
 */ 
#ifdef HAVE_POLL
#include <sys/poll.h>
#endif

So, if HAVE_POLL is indeed defined (as determined by 'configure'), you
will indeed be pulling in a system header file. Since poll.h is already
being included, what does it hurt to use the definitions for POLL* found
there? They will certainly be more accurate than just assuming
hard-coded values. My approach only resorts to the hard-coded values if
HAVE_POLL has not been defined. Otherwise, you risk your definitions
being incorrect for a given platform (which was the case for QNX).

Perhaps you can elaborate on your concerns. . . I must be missing
something subtle.

Thanks . . .
 

-----Original Message-----
From: havoc.pennington at gmail.com [mailto:havoc.pennington at gmail.com] On
Behalf Of Havoc Pennington
Sent: Friday, November 07, 2008 3:50 PM
To: Schmottlach, Glenn
Cc: dbus at lists.freedesktop.org
Subject: Re: Defining _DBUS_POLL* in dbus-sysdeps.h

Hi,

On Fri, Nov 7, 2008 at 11:18 AM, Schmottlach, Glenn
<GSchmott at harmanbecker.com> wrote:
> I wonder, if "HAVE_POLL" is already defined, then why not use the
actual
> POLL* values defined in the header sys/poll.h instead of hard-coding
values?
> The code would then look like this and be much more portable to other
OSes
> (namely QNX ;-):
>

The idea is to avoid system headers, so platform dependencies are
completely contained in the -sysdeps files

If system headers are included, inevitably they end up getting used or
relied on in some way.

Should just add a qnx case here probably.

Havoc



More information about the dbus mailing list