diff options
author | Greg Troxel <gdt@ir.bbn.com> | 2015-01-30 19:15:55 -0500 |
---|---|---|
committer | Greg Troxel <gdt@ir.bbn.com> | 2015-01-30 19:15:55 -0500 |
commit | b36efc999c5024cd9aa987f85ba8d4a4774823c5 (patch) | |
tree | 6ee0a8eb88ad14b11e232032b6fbb1aa711aa829 /serial.c | |
parent | cdcee1695f7e238367c03f1de1a4756945e19505 (diff) | |
download | gpsd-b36efc999c5024cd9aa987f85ba8d4a4774823c5.tar.gz |
Add workaround for VMIN/VTIME situation.
On NetBSD, there's something wrong between gpsd code, select and
termios's VMIN/VTIME. Until debugged, avoid it.
Diffstat (limited to 'serial.c')
-rw-r--r-- | serial.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -610,13 +610,27 @@ ssize_t gpsd_serial_write(struct gps_device_t * session, } void gpsd_optimize_io(struct gps_device_t *session, - const int minlength, const bool textual UNUSED) + int minlength, const bool textual UNUSED) /* optimize I/O mode depending on the minimum packet size */ { /* bail out if this is not actually a tty */ if (isatty(session->gpsdata.gps_fd) == 0) return; +#ifdef __NetBSD__ + /* + * Apparently NetBSD termios (at least on pty on netbsd-[56]) has + * trouble with VMIN=n VTIME=1. Or reads are aftempted when no + * bytes are present and none arrive, in which case read is + * correct for waiting indefinitely. Until this is + * debugged/fixed, avoid it, because even if it doesn't affect + * actual operation (unknown) it's important to preserve + * regression tests to allow bisecting for other bugs. + * http://pubs.opengroup.org/onlinepubs/007908799/xbd/termios.html + */ + minlength = 1; +#endif + /* * This is an optimization hack. The idea is to get away from * character-at-a-time I/O in order to slow down the rate at |