Why is select used in Linux
I was going through a serial program and I observed that they use select() before using read() . Why exactly is this required. Why cant we just directly call read() and check if it fails or not ? Also why do we have to increment the file descriptor by 1 and pass it while I am passing the file descriptor set already to select() ? Example: r=select(fd+1, &fds, NULL, NULL, &timeout); where fds already has the value of fd The select() system call tells you whether there is any data to read on the file descriptors that you're interested in. Strictly, it is a question of whether a read operation on