All pastes #2068962 Raw Edit

Miscellany

public text v1 · immutable
#2068962 ·published 2011-05-25 14:19 UTC
rendered paste body
#include <stdio.h>
#include <poll.h>
#include <fcntl.h>

int main()
{
    int ret;
    int p[2];
    struct pollfd fds[1];

    // libvirt uses a non-blocking pipe, but a "normal" pipe
    // also shows the same problem
    //pipe2(p, O_NONBLOCK);
    pipe(p);

    fds[0].fd = p[0];
    fds[0].events = POLLIN;
    fds[0].revents = 0;

    printf("before\n");

    ret = poll(fds, 1, -1);

    printf("after %d\n", ret);

    return 0;
}