Ok, so I got alot of tips how to solve the problem regarding poll. How ever, poll still returns instantly. It returns with POLLIN and POLLERR, so something is probably wrong. I'm not a c-program expert, so maybe someone can tell me what's wrong.

Here's what I've come up with so far:


#include <stdio.h>
#include <sys/poll.h>
#include <stdint.h>

int main () {
    struct pollfd fd;
    FILE *vcsa = fopen("/dev/vcsa", "rb");
    uint8_t header[4];
    fread(header, 0, sizeof(header), vcsa);
    fd.fd = fileno(vcsa);
    fd.events = POLLIN;
    for(int i = 0; i < 30; i++) {
        int ret = poll(&fd, 1, -1);
        printf("%d ", fd.revents);
    }
    printf("\nPOLLIN = %d POLLERR = %d\n", POLLIN, POLLERR);
    return 0;
}

On my machine, the program prints 30 9s and "POLLIN = 1 POLLERR = 8". It terminates instantly, even if I set the number of iterations to 1000. Something is clearly wrong!


I am running arch linux with kernel 4.18.16.


Tage

_______________________________________________
This message was sent via the BRLTTY mailing list.
To post a message, send an e-mail to: [email protected]
For general information, go to: http://brltty.app/mailman/listinfo/brltty

Reply via email to