bugst / go-serial

A cross-platform serial library for go-lang.
BSD 3-Clause "New" or "Revised" License
657 stars 199 forks source link

syscall select has limitations #128

Open kulti opened 2 years ago

kulti commented 2 years ago

Hi, select syscall has a limitations:

select() can monitor only file descriptors numbers that are less than FD_SETSIZE (1024)—an unreasonably low limit for many modern applications—and this limitation will not change. All modern applications should instead use poll(2) or epoll(7), which do not suffer this limitation.

https://man7.org/linux/man-pages/man2/select.2.html#DESCRIPTION

In practice it looks like, that fd is ready to read, but reads zero bytes.

I've found this issue using another library. At first, I try to find alternative implementations for serial and found your library with similar issue. I did not try to reproduce it with your library, but is should not make sense, because the problem in using the syscall select. You can look at my PR https://github.com/goburrow/serial/pull/20/files for reference of syscall poll usage.

12bchl commented 1 year ago

Any update on the status of this?

cmaglie commented 1 year ago

I'm not planning to do it. At least in the short term... If anyone is willing to give it a try I may review a PR (or at least it will be available to others to try).