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

Commit b8f9afc

Browse files
committed
Distinguish between AcquireExternalFD and epoll_create1 / kqueue failing
The error messages in CreateWaitEventSet() made it hard to know whether the syscall or AcquireExternalFD() failed. This is particularly relevant because AcquireExternalFD() imposes a lower limit than what would cause syscalls fail with EMFILE. I did not change the message in libpqsrv_connect_prepare(), which is the one other use of AcquireExternalFD() in our codebase, as the error message already is less ambiguous. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/xjjx7r4xa7beixuu4qtkdhnwdbchrrpo3gaeb3jsbinvvdiat5@cwjw55mna5of
1 parent 4ee130c commit b8f9afc

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/backend/storage/ipc/latch.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -811,10 +811,7 @@ CreateWaitEventSet(ResourceOwner resowner, int nevents)
811811

812812
#if defined(WAIT_USE_EPOLL)
813813
if (!AcquireExternalFD())
814-
{
815-
/* treat this as though epoll_create1 itself returned EMFILE */
816-
elog(ERROR, "epoll_create1 failed: %m");
817-
}
814+
elog(ERROR, "AcquireExternalFD, for epoll_create1, failed: %m");
818815
set->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
819816
if (set->epoll_fd < 0)
820817
{
@@ -823,10 +820,7 @@ CreateWaitEventSet(ResourceOwner resowner, int nevents)
823820
}
824821
#elif defined(WAIT_USE_KQUEUE)
825822
if (!AcquireExternalFD())
826-
{
827-
/* treat this as though kqueue itself returned EMFILE */
828-
elog(ERROR, "kqueue failed: %m");
829-
}
823+
elog(ERROR, "AcquireExternalFD, for kqueue, failed: %m");
830824
set->kqueue_fd = kqueue();
831825
if (set->kqueue_fd < 0)
832826
{

0 commit comments

Comments
 (0)