1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

uxpoll.c: cope with missing #defines in poll.h.

Baruch Siach reports that in a uClibc-ng build environment, POLLRDNORM
and friends are only defined by poll.h if you #define _XOPEN_SOURCE
before including it. So now we do that, in case it helps - and we also
cope with those #defines still being absent, in case on some other
system even that doesn't help.
This commit is contained in:
Simon Tatham 2019-03-26 18:37:26 +00:00
parent 464e351c7b
commit e9f0abad2e

View File

@ -1,3 +1,6 @@
/* On some systems this is needed to get poll.h to define eg.. POLLRDNORM */
#define _XOPEN_SOURCE
#include <poll.h>
#include "putty.h"
@ -72,6 +75,21 @@ void pollwrap_add_fd_events(pollwrapper *pw, int fd, int events)
pw->fds[f2p->pos].events |= events;
}
/* Omit any of the POLL{RD,WR}{NORM,BAND} flag values that are still
* not defined by poll.h, just in case */
#ifndef POLLRDNORM
#define POLLRDNORM 0
#endif
#ifndef POLLRDBAND
#define POLLRDBAND 0
#endif
#ifndef POLLWRNORM
#define POLLWRNORM 0
#endif
#ifndef POLLWRBAND
#define POLLWRBAND 0
#endif
#define SELECT_R_IN (POLLIN | POLLRDNORM | POLLRDBAND)
#define SELECT_W_IN (POLLOUT | POLLWRNORM | POLLWRBAND)
#define SELECT_X_IN (POLLPRI)