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

Keith Packard keithp at keithp.com
Sun May 29 18:35:16 UTC 2016


Emil Velikov <emil.l.velikov at gmail.com> writes:

> 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).

I'd expect whatever changes were needed to support those operating
systems to come from people using them. In particular, Windows has
winsock2.h, which may provide the necessary values, but as I'm not doing
that port, I can't really say what changes should be provided. I'd love
to get feedback from people who can provide it.

>  - 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.

Yeah, maybe just using X_NOTIFY_READ, X_NOTIFY_WRITE instead of
POLLIN/POLLOUT:

How about:

#define X_NOTIFY_READ   POLLIN
#define X_NOTIFY_WRITE  POLLOUT
#define X_NOTIFY_OTHER  (!(POLLIN|POLLOUT))

so you would do

        if (revents & X_NOTIFY_READ)
                read ready
        if (revents & X_NOTIFY_WRITE)
                write ready
        if (revents & X_NOTIFY_OTHER)
                deal with errors

Does this seem reasonable? It does change the ABI to tacitly depend on
the values in poll.h, but those aren't going to change.

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20160529/8a0480a3/attachment.sig>


More information about the xorg-devel mailing list