[PATCH xserver 17/23] os: Add ospoll interface

Emil Velikov emil.l.velikov at gmail.com
Sun May 29 10:11:15 UTC 2016


On 28 May 2016 at 02:53, Keith Packard <keithp at keithp.com> wrote:
> Emil Velikov <emil.l.velikov at gmail.com> writes:
>
>> Hi Keith,
>>
>> Style question: do you/how many others refer having separate functions for
>> of ifdeffed code each vs a single with all the ifdeffs. Or in other words
>> having func_foo_poll and func_foo_epoll as opposed to having it all in
>> func_foo.
>
> I started having separate versions of each function (with the same
> name), but that seemed bad, so I merged the contents of the separate
> functions into the single functions you see now. I found it easier to
> compare the semantics of the different implementations when they were
> right next to each other.
>
Haven't thought about that. Thanks.

>> +#ifndef _OSPOLL_H_
>>> +#define _OSPOLL_H_
>>> +
>>> +#include <poll.h>
>>> +
>>
>> This include should be in the C file with proper ifdef guard, right?
>
> I'm not sure I understand -- we need <poll.h> on every system as ospoll
> uses the POLLIN/POLLOUT defines for its arguments. We could use X server
> specific values, but I think the posix ones are common across all of our
> supported systems.
>
There's two things which I should have mentioned:
 - How does one have poll.h when poll() is missing - Cygwin may have
the header, although I'm not sure about other Windows based
implementations (the mingw and msvc ones).
 - Considering that we have our own header with wrapper functions and
an opaque struct, it would make sense to have X server specific
macros. Even (ideally) if they are ABI compatible with the POSIX ones.

-Emil


More information about the xorg-devel mailing list