0

The epoll event constants are defined on Linux as such:

enum EPOLL_EVENTS
  {
    EPOLLIN = 0x001,
#define EPOLLIN EPOLLIN
    EPOLLPRI = 0x002,
#define EPOLLPRI EPOLLPRI
    EPOLLOUT = 0x004,
#define EPOLLOUT EPOLLOUT
    EPOLLRDNORM = 0x040,
#define EPOLLRDNORM EPOLLRDNORM
    EPOLLRDBAND = 0x080,
#define EPOLLRDBAND EPOLLRDBAND
    EPOLLWRNORM = 0x100,
#define EPOLLWRNORM EPOLLWRNORM
    EPOLLWRBAND = 0x200,
#define EPOLLWRBAND EPOLLWRBAND
    EPOLLMSG = 0x400,
#define EPOLLMSG EPOLLMSG
    EPOLLERR = 0x008,
#define EPOLLERR EPOLLERR
    EPOLLHUP = 0x010,
#define EPOLLHUP EPOLLHUP
    EPOLLRDHUP = 0x2000,
#define EPOLLRDHUP EPOLLRDHUP
    EPOLLEXCLUSIVE = 1u << 28,
#define EPOLLEXCLUSIVE EPOLLEXCLUSIVE
    EPOLLWAKEUP = 1u << 29,
#define EPOLLWAKEUP EPOLLWAKEUP
    EPOLLONESHOT = 1u << 30,
#define EPOLLONESHOT EPOLLONESHOT
    EPOLLET = 1u << 31
#define EPOLLET EPOLLET
  };

What's the point of all the macro definitions? They don't seem to actually do anything.

tbodt
  • 16,609
  • 6
  • 58
  • 83
  • If I had to guess, it would be to intercept other macros stomping on the enum value names, causing compilation errors. –  Aug 20 '17 at 03:08
  • @Frank but the macros are defined after the corresponding enum values... – tbodt Aug 20 '17 at 03:20
  • @tbotd doesn't matter. Any macro defining EPOLLIN before or after will cause a compilation error (macro redefinition), so any attempt to tamper (Intentional or accidental) with the lib through that will fail. That's my guess, at least. –  Aug 20 '17 at 03:24
  • 1
    Or maybe, they are intended to be used in `#ifdef` directives? – Marian Aug 20 '17 at 06:08

0 Answers0