diff options
author | Tom Lane | 2017-04-27 21:13:29 +0000 |
---|---|---|
committer | Tom Lane | 2017-04-27 21:13:53 +0000 |
commit | 82ebbeb0abfe40fe5f19a6fcdffc7484fd3a35b0 (patch) | |
tree | bce59b87c7c2831ceef59ad9afde21071a01100d | |
parent | 2bef06d51646058c6bb480fcdbffb1f0cc914fed (diff) |
Cope with glibc too old to have epoll_create1().
Commit fa31b6f4e supposed that we didn't have to worry about that
anymore, but it seems that RHEL5 is like that, and that's still
a supported platform. Put back the prior coding under an #ifdef,
adding an explicit fcntl() to retain the desired CLOEXEC property.
Discussion: https://postgr.es/m/[email protected]
-rw-r--r-- | src/backend/storage/ipc/latch.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index 946fbff366..53e6bf2477 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -565,9 +565,18 @@ CreateWaitEventSet(MemoryContext context, int nevents) set->nevents_space = nevents; #if defined(WAIT_USE_EPOLL) +#ifdef EPOLL_CLOEXEC set->epoll_fd = epoll_create1(EPOLL_CLOEXEC); if (set->epoll_fd < 0) elog(ERROR, "epoll_create1 failed: %m"); +#else + /* cope with ancient glibc lacking epoll_create1 (e.g., RHEL5) */ + set->epoll_fd = epoll_create(nevents); + if (set->epoll_fd < 0) + elog(ERROR, "epoll_create failed: %m"); + if (fcntl(set->epoll_fd, F_SETFD, FD_CLOEXEC) == -1) + elog(ERROR, "fcntl(F_SETFD) failed on epoll descriptor: %m"); +#endif /* EPOLL_CLOEXEC */ #elif defined(WAIT_USE_WIN32) /* |