I found this piece of code in the tipc- config.c file that is present in the TIPC-UTILS downloads.
Code:
pfd.fd = sk;
pfd.events = ~POLLOUT;
if ((poll(&pfd, 1, 3000) != 1) || !(pfd.revents & POLLIN))
fatal("no reply detected from Netlink\n");
POLL returns 1. So, no problem there. But, the pfd.revents is set to "768" which drives the bitwise product to be 0. Hence, the program terminates. I read in the man pages that the revents parameter is set by the kernel based on the events that occur. What could be goin wrong here?
And interestingly, when i do this :
Code:
pfd.fd = sk;
pfd.events = POLLOUT;
if ((poll(&pfd, 1, 3000) != 1) || !(pfd.revents & POLLIN))
fatal("no reply detected from Netlink\n");
Which makes a little more sense, as POLLOUT stands for a "non-blocking write",the pfd.revents is returned as 4. Still doesnt help my cause though.