diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-04-27 17:13:29 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-04-27 17:13:54 -0400 |
commit | 53b157846024f28f8d48a6e0163c89a577f886a8 (patch) | |
tree | bdab00ab6d7a73594eb85688e2c612b8ddb81118 /src | |
parent | 28afff347a5db51a02b269fa13677d6924a88e78 (diff) | |
download | postgresql-53b157846024f28f8d48a6e0163c89a577f886a8.tar.gz postgresql-53b157846024f28f8d48a6e0163c89a577f886a8.zip |
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/12307.1493325329@sss.pgh.pa.us
Diffstat (limited to 'src')
-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 86e18a4aa6c..437ee6edc51 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -574,9 +574,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) /* |