projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup: Replace all perror() uses by the PERROR macro
[lttng-tools.git]
/
src
/
common
/
compat
/
compat-poll.c
diff --git
a/src/common/compat/compat-poll.c
b/src/common/compat/compat-poll.c
index 79fcb7d652b87230815c4d7b6d7146cf8546a9c2..6d34a0e69cbba04d133430d11fbce0626612bad0 100644
(file)
--- a/
src/common/compat/compat-poll.c
+++ b/
src/common/compat/compat-poll.c
@@
-16,6
+16,7
@@
*/
#define _GNU_SOURCE
*/
#define _GNU_SOURCE
+#define _LGPL_SOURCE
#include <assert.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <assert.h>
#include <stdlib.h>
#include <sys/resource.h>
@@
-52,6
+53,11
@@
static int resize_poll_event(struct compat_poll_event_array *array,
PERROR("realloc epoll add");
goto error;
}
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;
array->events = ptr;
array->alloc_size = new_size;
@@
-121,7
+127,7
@@
int compat_poll_create(struct lttng_poll_event *events, int size)
/* This *must* be freed by using lttng_poll_free() */
wait->events = zmalloc(size * sizeof(struct pollfd));
if (wait->events == NULL) {
/* 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;
}
goto error;
}
@@
-129,7
+135,7
@@
int compat_poll_create(struct lttng_poll_event *events, int size)
current->events = zmalloc(size * sizeof(struct pollfd));
if (current->events == NULL) {
current->events = zmalloc(size * sizeof(struct pollfd));
if (current->events == NULL) {
-
perror
("zmalloc struct current pollfd");
+
PERROR
("zmalloc struct current pollfd");
goto error;
}
goto error;
}
@@
-273,7
+279,7
@@
int compat_poll_wait(struct lttng_poll_event *events, int timeout)
ret = poll(events->wait.events, events->wait.nb_fd, timeout);
if (ret < 0) {
/* At this point, every error is fatal */
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;
}
goto error;
}
@@
-300,7
+306,7
@@
void compat_poll_set_max_size(void)
ret = getrlimit(RLIMIT_NOFILE, &lim);
if (ret < 0) {
ret = getrlimit(RLIMIT_NOFILE, &lim);
if (ret < 0) {
-
perror
("getrlimit poll RLIMIT_NOFILE");
+
PERROR
("getrlimit poll RLIMIT_NOFILE");
return;
}
return;
}
This page took
0.025049 seconds
and
4
git commands to generate.