*/
#define _GNU_SOURCE
+#define _LGPL_SOURCE
#include <assert.h>
#include <stdlib.h>
#include <sys/resource.h>
PERROR("realloc epoll add");
goto error;
}
+ if (new_size > array->alloc_size) {
+ /* Zero newly allocated memory */
+ memset(ptr + array->alloc_size, 0,
+ (new_size - array->alloc_size) * sizeof(*ptr));
+ }
array->events = ptr;
array->alloc_size = new_size;
/* This *must* be freed by using lttng_poll_free() */
wait->events = zmalloc(size * sizeof(struct pollfd));
if (wait->events == NULL) {
- perror("zmalloc struct pollfd");
+ PERROR("zmalloc struct pollfd");
goto error;
}
current->events = zmalloc(size * sizeof(struct pollfd));
if (current->events == NULL) {
- perror("zmalloc struct current pollfd");
+ PERROR("zmalloc struct current pollfd");
goto error;
}
ret = poll(events->wait.events, events->wait.nb_fd, timeout);
if (ret < 0) {
/* At this point, every error is fatal */
- perror("poll wait");
+ PERROR("poll wait");
goto error;
}
ret = getrlimit(RLIMIT_NOFILE, &lim);
if (ret < 0) {
- perror("getrlimit poll RLIMIT_NOFILE");
+ PERROR("getrlimit poll RLIMIT_NOFILE");
return;
}