fdmon-epoll.c (6e8a73e911f066527e775e04b98f31ebd19db600) | fdmon-epoll.c (d73415a315471ac0b127ed3fad45c8ec5d711de1) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2/* 3 * epoll(7) file descriptor monitoring 4 */ 5 6#include "qemu/osdep.h" 7#include <sys/epoll.h> 8#include "qemu/rcu_queue.h" --- 51 unchanged lines hidden (view full) --- 60 .fd = ctx->epollfd, 61 .events = G_IO_IN | G_IO_OUT | G_IO_HUP | G_IO_ERR, 62 }; 63 AioHandler *node; 64 int i, ret = 0; 65 struct epoll_event events[128]; 66 67 /* Fall back while external clients are disabled */ | 1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2/* 3 * epoll(7) file descriptor monitoring 4 */ 5 6#include "qemu/osdep.h" 7#include <sys/epoll.h> 8#include "qemu/rcu_queue.h" --- 51 unchanged lines hidden (view full) --- 60 .fd = ctx->epollfd, 61 .events = G_IO_IN | G_IO_OUT | G_IO_HUP | G_IO_ERR, 62 }; 63 AioHandler *node; 64 int i, ret = 0; 65 struct epoll_event events[128]; 66 67 /* Fall back while external clients are disabled */ |
68 if (atomic_read(&ctx->external_disable_cnt)) { | 68 if (qatomic_read(&ctx->external_disable_cnt)) { |
69 return fdmon_poll_ops.wait(ctx, ready_list, timeout); 70 } 71 72 if (timeout > 0) { 73 ret = qemu_poll_ns(&pfd, 1, timeout); 74 if (ret > 0) { 75 timeout = 0; 76 } --- 50 unchanged lines hidden (view full) --- 127 128bool fdmon_epoll_try_upgrade(AioContext *ctx, unsigned npfd) 129{ 130 if (ctx->epollfd < 0) { 131 return false; 132 } 133 134 /* Do not upgrade while external clients are disabled */ | 69 return fdmon_poll_ops.wait(ctx, ready_list, timeout); 70 } 71 72 if (timeout > 0) { 73 ret = qemu_poll_ns(&pfd, 1, timeout); 74 if (ret > 0) { 75 timeout = 0; 76 } --- 50 unchanged lines hidden (view full) --- 127 128bool fdmon_epoll_try_upgrade(AioContext *ctx, unsigned npfd) 129{ 130 if (ctx->epollfd < 0) { 131 return false; 132 } 133 134 /* Do not upgrade while external clients are disabled */ |
135 if (atomic_read(&ctx->external_disable_cnt)) { | 135 if (qatomic_read(&ctx->external_disable_cnt)) { |
136 return false; 137 } 138 139 if (npfd >= EPOLL_ENABLE_THRESHOLD) { 140 if (fdmon_epoll_try_enable(ctx)) { 141 return true; 142 } else { 143 fdmon_epoll_disable(ctx); --- 12 unchanged lines hidden --- | 136 return false; 137 } 138 139 if (npfd >= EPOLL_ENABLE_THRESHOLD) { 140 if (fdmon_epoll_try_enable(ctx)) { 141 return true; 142 } else { 143 fdmon_epoll_disable(ctx); --- 12 unchanged lines hidden --- |