diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-06-28 12:18:36 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-06-28 12:18:36 +0000 |
commit | 0b20190e7489c762b5815780344a9b1c30a63343 (patch) | |
tree | f53ca1841520187448a0313020f269f744f48d41 | |
parent | 07fb877e0a7eb9d87482b68bb45e839fdaf851d8 (diff) | |
download | gpsd-0b20190e7489c762b5815780344a9b1c30a63343.tar.gz |
Steps towards eliminating FIONREAD.
-rw-r--r-- | TODO | 12 | ||||
-rw-r--r-- | packet.c | 6 |
2 files changed, 12 insertions, 6 deletions
@@ -78,10 +78,14 @@ Rob Janssen writes: > --10, this further increases the load and slows down the backup to a crawl. > Killing gpsd makes the backup finish and then it can be started again. -He adds that this occurs with SiRF+Zodiac and SiRF+TSIP. He suspects -this may be due to a bug in the SiRF support, interacting with extreme -conditions in the Linux kernel's memory management. The bug seems not -to occur during ext3 backups, only Reiserfs ones. +He further observers that the FIONREAD ioctl() we use to check for +input waiting spins returning 0 when this happens. We suspect that +memory resource crises do something nasty to the buffering in the +Linux serial layer. The bug seems not to occur during ext3 backups, +only Reiserfs ones. + +This probably means we need to get rid of the FIONREAD ioctl(), which +has always been kind of dodgy anyway. ** To do: @@ -7,8 +7,8 @@ DESCRIPTION: Initial conditions of the problem: -1. We have a file descriptor open for read. The device on the other end is - sending packets at us. +1. We have a file descriptor open for (possibly non-blockin) read. The device + on the other end is sending packets at us. 2. It may require more than one read to gather a packet. Reads may span packet boundaries. @@ -527,6 +527,8 @@ int packet_get(struct gps_device_t *session, size_t waiting) if (newdata < 0 && errno != EAGAIN) return BAD_PACKET; + else if (newdata == 0 || (newdata < 0 && errno == EAGAIN)) + return 0; #ifdef STATE_DEBUG gpsd_report(6, "Read %d chars to buffer offset %d (total %d): %s\n", |