DF-5842 / t8.c
#include <sys/select.h> #include <sys/time.h> #include <stdio.h> #include <signal.h> #include <unistd.h> #include <errno.h> static void d(int s){} int main(void){ struct timeval tv; fd_set r; int p[2]; double t0; struct timespec ts; pipe(p); FD_ZERO(&r); FD_SET(p[0], &r); signal(SIGALRM, d); alarm(30); /* T8: select tstohz path, 2^62 us unnormalized */ tv.tv_sec = 0; tv.tv_usec = 4611686018427387904LL; clock_gettime(CLOCK_MONOTONIC, &ts); t0 = ts.tv_sec + ts.tv_nsec/1e9; int rc = select(p[0]+1, &r, NULL, NULL, &tv); clock_gettime(CLOCK_MONOTONIC, &ts); printf("T8 select{ 0s, 2^62us } rc=%d errno=%d elapsed=%.6f\n", rc, errno, ts.tv_sec + ts.tv_nsec/1e9 - t0); return 0; } |