src__lib__libast__features__lib.diff [plain text]
--- src/lib/libast/features/lib.orig 2004-12-02 16:13:10.000000000 -0500
+++ src/lib/libast/features/lib 2005-05-25 22:16:41.000000000 -0400
@@ -318,6 +318,7 @@
}end
tst socket_peek note{ recv(MSG_PEEK) works }end execute{
+ #include <poll.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -327,6 +328,7 @@
int i;
int fds[2];
char buf[128];
+ struct pollfd pfd;
static char msg[] = "abcd";
@@ -344,6 +346,18 @@
for (i = 0; i < sizeof(msg); i++)
if (buf[i] != msg[i])
return 1;
+
+ if (pipe(fds) < 0)
+ return 1;
+ if (write(fds[1], msg, sizeof(msg)) != sizeof(msg))
+ return 1;
+ if (recv(fds[0], buf, sizeof(buf), MSG_PEEK) != sizeof(msg))
+ return 1;
+ pfd.fd = fds[0];
+ pfd.events = POLLIN;
+ if (poll(&pfd, 1, 0) != 1 || pfd.revents != POLLIN)
+ return 1;
+
return 0;
}
}end