While technically 1==2^0 is a power of two, the ROUNDUPPWR2
was changing the size of the epoll set to 2 before we tested
for two; since this set does not grow, we were getting errors
trying to add low-value FDs to the set, causing errors.

Slightly rearranging the order in which we do these operations
fixes this.

Change-Id: I2d068416941e8e1e9d7cfa98d56f5ea5b159802b
Signed-off-by: Dan Cross <[email protected]>
---
 user/iplib/epoll.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/user/iplib/epoll.c b/user/iplib/epoll.c
index 87fdae5..b370981 100644
--- a/user/iplib/epoll.c
+++ b/user/iplib/epoll.c
@@ -211,10 +211,12 @@ static void epoll_close(struct user_fd *ufd)
 
 static int init_ep_ctlr(struct epoll_ctlr *ep, int size)
 {
-       unsigned int ceq_size = ROUNDUPPWR2(size);
+       unsigned int ceq_size;
+
        /* TODO: we don't grow yet.  Until then, we help out a little. */
        if (size == 1)
                size = 128;
+       ceq_size = ROUNDUPPWR2(size);
        ep->size = ceq_size;
        ep->mtx = uth_mutex_alloc();
        ep->ufd.magic = EPOLL_UFD_MAGIC;
-- 
2.8.0.rc3.226.g39d4020

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to