aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2021-03-01 10:44:21 +1300
committerThomas Munro <tmunro@postgresql.org>2021-03-01 11:24:28 +1300
commitd1b90995e8d41df7e59efe48e98f26cd66baba9b (patch)
tree55692e651dd2575cffc585819b065a0a04c31596
parent943eb478803cc2ed6f0b1f5df6f1b20c9ad6245d (diff)
downloadpostgresql-d1b90995e8d41df7e59efe48e98f26cd66baba9b.tar.gz
postgresql-d1b90995e8d41df7e59efe48e98f26cd66baba9b.zip
Remove latch.c workaround for Linux < 2.6.27.
Commit 82ebbeb0 added a workaround for systems with no epoll_create1() and EPOLL_CLOEXEC. Linux < 2.6.27 and glibc < 2.9 are long gone. Now seems like a good time to drop the extra code, because otherwise we'd have to add similar already-dead workaround code to new patches using XXX_CLOEXEC flags that arrived in the same kernel release. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CA%2BhUKGKL_%3DaO%3Dr30N%3Ds9VoDgTqHpRSzePRbA9dkYO7snc7HsxA%40mail.gmail.com
-rw-r--r--src/backend/storage/ipc/latch.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c
index f2d005eea05..79b9627831f 100644
--- a/src/backend/storage/ipc/latch.c
+++ b/src/backend/storage/ipc/latch.c
@@ -666,31 +666,12 @@ CreateWaitEventSet(MemoryContext context, int nevents)
/* treat this as though epoll_create1 itself returned EMFILE */
elog(ERROR, "epoll_create1 failed: %m");
}
-#ifdef EPOLL_CLOEXEC
set->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
if (set->epoll_fd < 0)
{
ReleaseExternalFD();
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)
- {
- ReleaseExternalFD();
- elog(ERROR, "epoll_create failed: %m");
- }
- if (fcntl(set->epoll_fd, F_SETFD, FD_CLOEXEC) == -1)
- {
- int save_errno = errno;
-
- close(set->epoll_fd);
- ReleaseExternalFD();
- errno = save_errno;
- elog(ERROR, "fcntl(F_SETFD) failed on epoll descriptor: %m");
- }
-#endif /* EPOLL_CLOEXEC */
#elif defined(WAIT_USE_KQUEUE)
if (!AcquireExternalFD())
{
@@ -736,7 +717,7 @@ CreateWaitEventSet(MemoryContext context, int nevents)
*
* Note: preferably, this shouldn't have to free any resources that could be
* inherited across an exec(). If it did, we'd likely leak those resources in
- * many scenarios. For the epoll case, we ensure that by setting FD_CLOEXEC
+ * many scenarios. For the epoll case, we ensure that by setting EPOLL_CLOEXEC
* when the FD is created. For the Windows case, we assume that the handles
* involved are non-inheritable.
*/