diff options
-rw-r--r-- | source3/include/proto.h | 1 | ||||
-rw-r--r-- | source3/lib/util_sock.c | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 581c423fa6..c080fd74bc 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1334,6 +1334,7 @@ struct tevent_req *getaddrinfo_send(TALLOC_CTX *mem_ctx, const struct addrinfo *hints); int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res); int poll_one_fd(int fd, int events, int timeout, int *revents); +int poll_intr_one_fd(int fd, int events, int timeout, int *revents); struct tevent_req *tstream_read_packet_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct tstream_context *stream, diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 3dd84fe8d7..51de68f4c3 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -1793,3 +1793,20 @@ int poll_one_fd(int fd, int events, int timeout, int *revents) return ret; } + +int poll_intr_one_fd(int fd, int events, int timeout, int *revents) +{ + struct pollfd pfd; + int ret; + + pfd.fd = fd; + pfd.events = events; + + ret = sys_poll_intr(&pfd, 1, timeout); + if (ret <= 0) { + *revents = 0; + return ret; + } + *revents = pfd.revents; + return 1; +} |