Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d1b9099

Browse files
committed
Remove latch.c workaround for Linux < 2.6.27.
Commit 82ebbeb 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
1 parent 943eb47 commit d1b9099

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

src/backend/storage/ipc/latch.c

+1-20
Original file line numberDiff line numberDiff line change
@@ -666,31 +666,12 @@ CreateWaitEventSet(MemoryContext context, int nevents)
666666
/* treat this as though epoll_create1 itself returned EMFILE */
667667
elog(ERROR, "epoll_create1 failed: %m");
668668
}
669-
#ifdef EPOLL_CLOEXEC
670669
set->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
671670
if (set->epoll_fd < 0)
672671
{
673672
ReleaseExternalFD();
674673
elog(ERROR, "epoll_create1 failed: %m");
675674
}
676-
#else
677-
/* cope with ancient glibc lacking epoll_create1 (e.g., RHEL5) */
678-
set->epoll_fd = epoll_create(nevents);
679-
if (set->epoll_fd < 0)
680-
{
681-
ReleaseExternalFD();
682-
elog(ERROR, "epoll_create failed: %m");
683-
}
684-
if (fcntl(set->epoll_fd, F_SETFD, FD_CLOEXEC) == -1)
685-
{
686-
int save_errno = errno;
687-
688-
close(set->epoll_fd);
689-
ReleaseExternalFD();
690-
errno = save_errno;
691-
elog(ERROR, "fcntl(F_SETFD) failed on epoll descriptor: %m");
692-
}
693-
#endif /* EPOLL_CLOEXEC */
694675
#elif defined(WAIT_USE_KQUEUE)
695676
if (!AcquireExternalFD())
696677
{
@@ -736,7 +717,7 @@ CreateWaitEventSet(MemoryContext context, int nevents)
736717
*
737718
* Note: preferably, this shouldn't have to free any resources that could be
738719
* inherited across an exec(). If it did, we'd likely leak those resources in
739-
* many scenarios. For the epoll case, we ensure that by setting FD_CLOEXEC
720+
* many scenarios. For the epoll case, we ensure that by setting EPOLL_CLOEXEC
740721
* when the FD is created. For the Windows case, we assume that the handles
741722
* involved are non-inheritable.
742723
*/

0 commit comments

Comments
 (0)