From: Felix Fietkau Date: Mon, 6 Dec 2010 15:54:13 +0000 (+0100) Subject: uloop: add a flag for keeping the socket blocking X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cd086c7c1558eb5816711f4fdc6e21524a01ddca;p=oweals%2Flibubox.git uloop: add a flag for keeping the socket blocking --- diff --git a/uloop.c b/uloop.c index ec37925..a263a01 100644 --- a/uloop.c +++ b/uloop.c @@ -236,7 +236,7 @@ int uloop_fd_add(struct uloop_fd *sock, unsigned int flags) unsigned int fl; int ret; - if (!sock->registered) { + if (!sock->registered && !(flags & ULOOP_BLOCKING)) { fl = fcntl(sock->fd, F_GETFL, 0); fl |= O_NONBLOCK; fcntl(sock->fd, F_SETFL, fl); diff --git a/uloop.h b/uloop.h index 35ee3a5..10a117f 100644 --- a/uloop.h +++ b/uloop.h @@ -39,6 +39,7 @@ typedef void (*uloop_timeout_handler)(struct uloop_timeout *t); #define ULOOP_READ (1 << 0) #define ULOOP_WRITE (1 << 1) #define ULOOP_EDGE_TRIGGER (1 << 2) +#define ULOOP_BLOCKING (1 << 3) struct uloop_fd {