s3: Add poll_intr_one_fd
authorVolker Lendecke <vl@samba.org>
Tue, 8 Feb 2011 16:33:59 +0000 (17:33 +0100)
committerVolker Lendecke <vlendec@samba.org>
Mon, 28 Feb 2011 15:40:19 +0000 (16:40 +0100)
source3/include/proto.h
source3/lib/util_sock.c

index 581c423fa6505fcf47f1f18e4fcf9c169cf4a8dd..c080fd74bc1f466249a0de47c502b08886f43033 100644 (file)
@@ -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,
index 3dd84fe8d701b10b9a6d8ef11b7d64df929e5f09..51de68f4c397f0ce115a245473765ca8861fa0c1 100644 (file)
@@ -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;
+}