gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] tests hanging on netsbd-6 i386


From: Eric S. Raymond
Subject: Re: [gpsd-dev] tests hanging on netsbd-6 i386
Date: Fri, 30 Jan 2015 12:25:20 -0500
User-agent: Mutt/1.5.23 (2014-03-12)

Greg Troxel <address@hidden>:
> 
> I found the problem, sort of.  The following test makes the first two
> tests pass (at release-3.11-311-g7de7d97) rather than hang.  This is
> obviously not what should be committed, but somehow the pty is ending up
> without NONBLOCK.
> 
> diff --git a/packet.c b/packet.c
> index 02b18e5..8119d36 100644
> --- a/packet.c
> +++ b/packet.c
> @@ -2096,11 +2096,22 @@ void packet_parse(struct gps_lexer_t *lexer)
>  
>  #undef getword
>  
> +#include <fcntl.h>
> +
>  ssize_t packet_get(int fd, struct gps_lexer_t *lexer)
>  /* grab a packet; return -1=>I/O error, 0=>EOF, or a length */
>  {
>      ssize_t recvd;
>  
> +    {
> +      int i = fcntl(fd, F_GETFL, 0);
> +      if ((i & O_NONBLOCK) == 0) {
> +     gpsd_report(&lexer->errout, LOG_ERROR,
> +                 "packet_get: fd %d found without NONBLOCK", fd);
> +     fcntl(fd, F_SETFL, O_NONBLOCK);
> +      }
> +    }
> +
>      /*@ -modobserver @*/
>      errno = 0;
>      recvd = read(fd, lexer->inbuffer + lexer->inbuflen,


I think this is solving the wrong problem.   We want the tty I/O to remain
blocking, because every tty read is guarded by select and the fact that
the read always returns at least one character when its called is
a useful invariant.

On the other hand, if the BSD tty  driver doesn't honor the VTIME and
VMIN fields we may have to do it this way.
-- 
                <a href="http://www.catb.org/~esr/";>Eric S. Raymond</a>

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]