summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-06-28 12:18:36 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-06-28 12:18:36 +0000
commit0b20190e7489c762b5815780344a9b1c30a63343 (patch)
treef53ca1841520187448a0313020f269f744f48d41
parent07fb877e0a7eb9d87482b68bb45e839fdaf851d8 (diff)
downloadgpsd-0b20190e7489c762b5815780344a9b1c30a63343.tar.gz
Steps towards eliminating FIONREAD.
-rw-r--r--TODO12
-rw-r--r--packet.c6
2 files changed, 12 insertions, 6 deletions
diff --git a/TODO b/TODO
index ec800058..641622b5 100644
--- a/TODO
+++ b/TODO
@@ -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:
diff --git a/packet.c b/packet.c
index 964441d3..38abc682 100644
--- a/packet.c
+++ b/packet.c
@@ -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",