GNU bug report logs - #13018
fport_fill_input should handle EINTR

Previous Next

Package: guile;

Reported by: Aidan Gauland <aidalgol <at> no8wireless.co.nz>

Date: Wed, 28 Nov 2012 08:22:01 UTC

Severity: normal

Done: Mark H Weaver <mhw <at> netris.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: ludo <at> gnu.org (Ludovic Courtès)
To: Aidan Gauland <aidalgol <at> no8wireless.co.nz>
Cc: "Mark H. Weaver" <mhw <at> netris.org>, 13018 <at> debbugs.gnu.org
Subject: bug#13018: fport_fill_input should handle EINTR
Date: Thu, 29 Nov 2012 21:19:48 +0100
Hi!

Aidan Gauland <aidalgol <at> no8wireless.co.nz> skribis:

> <mark_weaver> fport_fill_input should handle an EINTR error from 'read',
>               and restart the read if that happens.
>
> <mark_weaver> by default on some systems, signals cause 'read', 'write',
>               and many other system calls to abort and return an EINTR
>               error.
>
> <mark_weaver> basically, at the POSIX level, every call to 'read' has to
>               be within a little loop that takes care of the EINTR
>               problem.

‘fport_fill_input’ does this:

  SCM_SYSCALL (count = read (fp->fdes, pt->read_buf, pt->read_buf_size));

and SCM_SYSCALL does that:

  # ifdef EINTR
  #  if (EINTR > 0)
  #   define SCM_SYSCALL(line)                    \
    do                                            \
      {                                           \
        errno = 0;                                \
        line;                                     \
        if (errno == EINTR)                       \
          {                                       \
            SCM_ASYNC_TICK;                       \
            continue;                             \
          }                                       \
      }                                           \
    while(0)
  #  endif /*  (EINTR > 0) */
  # endif /* def EINTR */

On GNU/Linux, I see:

  $ echo '#include <errno.h>' | gcc -E -dM - | grep EINTR
  #define EINTR 4

So AFAICS, the EINTR case is taken care of.  Or am I missing something?

Do you have a reduced test case?

Thanks,
Ludo’.




This bug report was last modified 11 years and 347 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.