mirror of
https://github.com/postgres/postgres.git
synced 2025-06-03 01:21:48 +03:00
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
This commit is contained in:
parent
4ee130c6e0
commit
b8f9afc81f
@ -811,10 +811,7 @@ CreateWaitEventSet(ResourceOwner resowner, int nevents)
|
|||||||
|
|
||||||
#if defined(WAIT_USE_EPOLL)
|
#if defined(WAIT_USE_EPOLL)
|
||||||
if (!AcquireExternalFD())
|
if (!AcquireExternalFD())
|
||||||
{
|
elog(ERROR, "AcquireExternalFD, for epoll_create1, failed: %m");
|
||||||
/* treat this as though epoll_create1 itself returned EMFILE */
|
|
||||||
elog(ERROR, "epoll_create1 failed: %m");
|
|
||||||
}
|
|
||||||
set->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
|
set->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
|
||||||
if (set->epoll_fd < 0)
|
if (set->epoll_fd < 0)
|
||||||
{
|
{
|
||||||
@ -823,10 +820,7 @@ CreateWaitEventSet(ResourceOwner resowner, int nevents)
|
|||||||
}
|
}
|
||||||
#elif defined(WAIT_USE_KQUEUE)
|
#elif defined(WAIT_USE_KQUEUE)
|
||||||
if (!AcquireExternalFD())
|
if (!AcquireExternalFD())
|
||||||
{
|
elog(ERROR, "AcquireExternalFD, for kqueue, failed: %m");
|
||||||
/* treat this as though kqueue itself returned EMFILE */
|
|
||||||
elog(ERROR, "kqueue failed: %m");
|
|
||||||
}
|
|
||||||
set->kqueue_fd = kqueue();
|
set->kqueue_fd = kqueue();
|
||||||
if (set->kqueue_fd < 0)
|
if (set->kqueue_fd < 0)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user