diff options
author | Volker Lendecke <vl@samba.org> | 2011-02-08 17:33:59 +0100 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2011-02-28 16:40:19 +0100 |
commit | 884984ae0a9b551dcd92d6d0486b2d741eabd20f (patch) | |
tree | 5cd5348b260f0c385c283bfddb6211e6cafef8a1 | |
parent | 83becbe369bcf3478063662fc2626ccbf4530b20 (diff) | |
download | samba-884984ae0a9b551dcd92d6d0486b2d741eabd20f.tar.gz samba-884984ae0a9b551dcd92d6d0486b2d741eabd20f.tar.bz2 samba-884984ae0a9b551dcd92d6d0486b2d741eabd20f.zip |
s3: Add poll_intr_one_fd
-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; +} |