networking · beginner · ~15 min

Any readable fd?

Test a readiness bit across fds.

Challenge

Implement int any_readable(const int *revents, int n, int pollin) returning 1 if any fd has the POLLIN bit (revents[i] & pollin) set, else 0.

Starter code

int any_readable(const int *revents, int n, int pollin) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.