8

Why is select used in Linux

view full story
linux-howto

http://stackoverflow.com – 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 (HowTos)