24 #include <sys/select.h> 26 #include <sys/types.h> 39 static const char hex_map[FSEL_FILES] =
"0123456789ABCDEF";
43 for (i = 0; i < FSEL_FILES; i++) {
44 char name[] = { hex_map[i],
'\0' };
45 fds[i] = open(name, O_RDONLY);
51 nfds = fds[FSEL_FILES - 1] + 1;
53 for(tries=0; tries < 16; tries++) {
54 static char buf[4096];
59 for (i = 0; i < FSEL_FILES; i++)
60 FD_SET(fds[i], &rfds);
62 rc = select(nfds, &rfds, NULL, NULL, NULL);
69 for (i = 0; i < FSEL_FILES; i++) {
70 if (!FD_ISSET(fds[i], &rfds)) {
75 rc = read(fds[i], buf,
sizeof(buf));