Skip to content

Commit 82ebbeb

Browse files
committed
Cope with glibc too old to have epoll_create1().
Commit fa31b6f 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
1 parent 2bef06d commit 82ebbeb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/backend/storage/ipc/latch.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,18 @@ CreateWaitEventSet(MemoryContext context, int nevents)
565565
set->nevents_space = nevents;
566566

567567
#if defined(WAIT_USE_EPOLL)
568+
#ifdef EPOLL_CLOEXEC
568569
set->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
569570
if (set->epoll_fd < 0)
570571
elog(ERROR, "epoll_create1 failed: %m");
572+
#else
573+
/* cope with ancient glibc lacking epoll_create1 (e.g., RHEL5) */
574+
set->epoll_fd = epoll_create(nevents);
575+
if (set->epoll_fd < 0)
576+
elog(ERROR, "epoll_create failed: %m");
577+
if (fcntl(set->epoll_fd, F_SETFD, FD_CLOEXEC) == -1)
578+
elog(ERROR, "fcntl(F_SETFD) failed on epoll descriptor: %m");
579+
#endif /* EPOLL_CLOEXEC */
571580
#elif defined(WAIT_USE_WIN32)
572581

573582
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy