Opened 12 years ago
Last modified 7 years ago
#4559 new Bugs
Need baud rate workaround in asio for bug in glibc
Reported by: | Owned by: | chris_kohlhoff | |
---|---|---|---|
Milestone: | To Be Determined | Component: | asio |
Version: | Boost 1.44.0 | Severity: | Problem |
Keywords: | Cc: |
Description
In glibc 2.12.1 (the current version), and all previous versions, there are bugs in the Linux implementations of the tcsetattr and tcgetattr functions so that the c_ispeed and c_ospeed fields of the termios data structure are not correctly passed to and from the kernel. More specifically, the implementations of these functions use ioctl commands TCSETS and TCGETS when they should use TCSETS2 and TCGETS2 (for Linux). Because of this, it is currently not possible to set/get an arbitrary baud rate on Linux through the tcsetattr and tcgetattr library functions. Because Boost asio currently uses tcsetattr and tcgetattr, its baud rate setting functions can not currently handle anything but the standard Posix baud rates. To work around this bug in glibc (which was reported a long time ago and never fixed), I think asio should call ioctl directly on Linux rather than using tcgetattr and tcsetattr (in the file boost/asio/detail/impl/reactive_serial_port_service.ipp). I consider this a bug in asio because whether or not it is ever fixed in glibc, old versions of glibc that have the bug will continue to be used for years to come. I feel that Boost should work around bugs in individual operating systems whenever it is trivial to do so (which it is in this case).
Change History (2)
comment:1 by , 11 years ago
comment:2 by , 7 years ago
Still exist in Boost 1.59.0 on Mac OS X 10.11.1. I would like to set baudrate to 250000.
This problem still exists in Boost 1.48.0 on Mac OS X 10.6.8. I am unable to set a baud rate of 31250.