mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-01 16:01:23 +02:00
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
This commit is contained in:
parent
2bef06d516
commit
82ebbeb0ab
@ -565,9 +565,18 @@ CreateWaitEventSet(MemoryContext context, int nevents)
|
|||||||
set->nevents_space = nevents;
|
set->nevents_space = nevents;
|
||||||
|
|
||||||
#if defined(WAIT_USE_EPOLL)
|
#if defined(WAIT_USE_EPOLL)
|
||||||
|
#ifdef EPOLL_CLOEXEC
|
||||||
set->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
|
set->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
|
||||||
if (set->epoll_fd < 0)
|
if (set->epoll_fd < 0)
|
||||||
elog(ERROR, "epoll_create1 failed: %m");
|
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)
|
#elif defined(WAIT_USE_WIN32)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user