summaryrefslogtreecommitdiffstats
path: root/src/fd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fd.c')
-rw-r--r--src/fd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/fd.c b/src/fd.c
index 9d34315..9b62515 100644
--- a/src/fd.c
+++ b/src/fd.c
@@ -84,8 +84,8 @@
#if defined(USE_POLL)
#include <poll.h>
-#include <errno.h>
#endif
+#include <errno.h>
#include <haproxy/api.h>
#include <haproxy/activity.h>
@@ -981,8 +981,8 @@ void my_closefrom(int start)
break;
} while (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR || errno == ENOMEM);
- if (ret)
- ret = fd - start;
+ /* always check the whole range */
+ ret = fd - start;
for (idx = 0; idx < ret; idx++) {
if (poll_events[idx].revents & POLLNVAL)
@@ -1108,6 +1108,7 @@ void poller_pipe_io_handler(int fd)
static int alloc_pollers_per_thread()
{
fd_updt = calloc(global.maxsock, sizeof(*fd_updt));
+ vma_set_name_id(fd_updt, global.maxsock * sizeof(*fd_updt), "fd", "fd_updt", tid + 1);
return fd_updt != NULL;
}
@@ -1158,10 +1159,11 @@ int init_pollers()
int p;
struct poller *bp;
- if ((fdtab_addr = calloc(global.maxsock, sizeof(*fdtab) + 64)) == NULL) {
+ if ((fdtab_addr = calloc(1, global.maxsock * sizeof(*fdtab) + 64)) == NULL) {
ha_alert("Not enough memory to allocate %d entries for fdtab!\n", global.maxsock);
goto fail_tab;
}
+ vma_set_name(fdtab_addr, global.maxsock * sizeof(*fdtab) + 64, "fd", "fdtab_addr");
/* always provide an aligned fdtab */
fdtab = (struct fdtab*)((((size_t)fdtab_addr) + 63) & -(size_t)64);
@@ -1170,11 +1172,13 @@ int init_pollers()
ha_alert("Not enough memory to allocate %d entries for polled_mask!\n", global.maxsock);
goto fail_polledmask;
}
+ vma_set_name(polled_mask, global.maxsock * sizeof(*polled_mask), "fd", "polled_mask");
if ((fdinfo = calloc(global.maxsock, sizeof(*fdinfo))) == NULL) {
ha_alert("Not enough memory to allocate %d entries for fdinfo!\n", global.maxsock);
goto fail_info;
}
+ vma_set_name(fdinfo, global.maxsock * sizeof(*fdinfo), "fd", "fdinfo");
for (p = 0; p < MAX_TGROUPS; p++)
update_list[p].first = update_list[p].last = -1;