projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: memleaks in channel/event notify
[lttng-tools.git]
/
src
/
common
/
compat
/
compat-epoll.c
diff --git
a/src/common/compat/compat-epoll.c
b/src/common/compat/compat-epoll.c
index f014a0d783d434f57fc95a5c17e126f62946e74e..903a9f8256eeafad9e678f565ba6c1b60f0e9c2a 100644
(file)
--- a/
src/common/compat/compat-epoll.c
+++ b/
src/common/compat/compat-epoll.c
@@
-27,6
+27,8
@@
#include <common/error.h>
#include <common/defaults.h>
#include <common/error.h>
#include <common/defaults.h>
+#include <common/macros.h>
+#include <common/utils.h>
#include "poll.h"
#include "poll.h"
@@
-201,11
+203,15
@@
int compat_epoll_wait(struct lttng_poll_event *events, int timeout)
*/
if (events->nb_fd > events->alloc_size) {
/* Expand if the nb_fd is higher than the actual size. */
*/
if (events->nb_fd > events->alloc_size) {
/* Expand if the nb_fd is higher than the actual size. */
- new_size = events->alloc_size << 1UL;
+ new_size = max_t(uint32_t,
+ 1U << utils_get_count_order_u32(events->nb_fd),
+ events->alloc_size << 1UL);
} else if ((events->nb_fd << 1UL) <= events->alloc_size &&
events->nb_fd >= events->init_size) {
/* Shrink if nb_fd multiplied by two is <= than the actual size. */
} else if ((events->nb_fd << 1UL) <= events->alloc_size &&
events->nb_fd >= events->init_size) {
/* Shrink if nb_fd multiplied by two is <= than the actual size. */
- new_size = events->alloc_size >> 1UL;
+ new_size = max_t(uint32_t,
+ utils_get_count_order_u32(events->nb_fd) >> 1U,
+ events->alloc_size >> 1U);
} else {
/* Indicate that we don't want to resize. */
new_size = 0;
} else {
/* Indicate that we don't want to resize. */
new_size = 0;
This page took
0.030228 seconds
and
4
git commands to generate.