Groups | Search | Server Info | Login | Register


Groups > comp.lang.misc > #11341

Re: Interrupted system call on read after ~20 minutes inactivity?

From Alan Bawden <alan@csail.mit.edu>
Newsgroups comp.lang.misc
Subject Re: Interrupted system call on read after ~20 minutes inactivity?
Date 2025-10-06 04:05 -0400
Organization ITS Preservation Society
Message-ID <86y0po3161.fsf@williamsburg.bawden.org> (permalink)
References <10bpkh1$25arg$1@dont-email.me> <867bxb4l3a.fsf@williamsburg.bawden.org> <10bpo36$262ue$1@dont-email.me> <86347z4ims.fsf@williamsburg.bawden.org> <10btld4$4rsi$1@artemis.inf.ed.ac.uk>

Show all headers | View raw


richard@cogsci.ed.ac.uk (Richard Tobin) writes:

   In article <86347z4ims.fsf@williamsburg.bawden.org>,
   Alan Bawden  <alan@csail.mit.edu> wrote:

   >It's not necessarily a timeout.  Maybe something else in the system
   >sets up an interrupt handler for some other reason.  EINTR happens.
   >Be prepared.

   BSD fixed this over 40 years ago, but unfortunately System V messed
   everything up and Posix insisted on supporting both.

   Use sigaction() with SA_RESTART instead of signal() and you shouldn't
   get EINTR for read().

Oh!  I hadn't realized that SA_RESTART was actually part of Posix!  I
thought it was a BSD thing that you couldn't use if you wanted to be
fully portable.  Since I've been programming in C on various flavors of
Unix for about 40 years, I guess that may have been the case when I
first started out, and I never noticed that things had changed.

I notice that the sigaction(2) manual page on a recent FreeBSD install
still says:

     The sigaction() system call is expected to conform to IEEE Std
     1003.1-1990 ("POSIX.1").  The SA_ONSTACK and SA_RESTART flags are
     Berkeley extensions, ...

Which sure makes it sound like SA_RESTART might not exist elsewhere.
Perhaps it didn't in the version of Posix referred to here, and the
manual page hasn't been updated in a long time...

So thank you for showing me something I wasn't aware of!

-- 
Alan Bawden

Back to comp.lang.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Interrupted system call on read after ~20 minutes inactivity? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-04 00:59 +0200
  Re: Interrupted system call on read after ~20 minutes inactivity? scott@slp53.sl.home (Scott Lurndal) - 2025-10-03 23:31 +0000
    Re: Interrupted system call on read after ~20 minutes inactivity? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-04 01:57 +0200
    Re: Interrupted system call on read after ~20 minutes inactivity? Kaz Kylheku <643-408-1753@kylheku.com> - 2025-10-04 00:28 +0000
      Re: Interrupted system call on read after ~20 minutes inactivity? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-04 02:41 +0200
        Re: Interrupted system call on read after ~20 minutes inactivity? Kaz Kylheku <643-408-1753@kylheku.com> - 2025-10-04 01:07 +0000
      Re: Interrupted system call on read after ~20 minutes inactivity? richard@cogsci.ed.ac.uk (Richard Tobin) - 2025-10-04 01:04 +0000
        Re: Interrupted system call on read after ~20 minutes inactivity? Kaz Kylheku <643-408-1753@kylheku.com> - 2025-10-04 01:23 +0000
        Re: Interrupted system call on read after ~20 minutes inactivity? Kaz Kylheku <643-408-1753@kylheku.com> - 2025-10-04 01:28 +0000
          Re: Interrupted system call on read after ~20 minutes inactivity? scott@slp53.sl.home (Scott Lurndal) - 2025-10-04 02:12 +0000
        Re: Interrupted system call on read after ~20 minutes inactivity? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-04 02:35 +0000
        Re: Interrupted system call on read after ~20 minutes inactivity? richard@cogsci.ed.ac.uk (Richard Tobin) - 2025-10-04 12:52 +0000
          Re: Interrupted system call on read after ~20 minutes inactivity? Kaz Kylheku <643-408-1753@kylheku.com> - 2025-10-04 18:50 +0000
  Re: Interrupted system call on read after ~20 minutes inactivity? Alan Bawden <alan@csail.mit.edu> - 2025-10-03 19:33 -0400
    Re: Interrupted system call on read after ~20 minutes inactivity? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-03 23:54 +0000
    Re: Interrupted system call on read after ~20 minutes inactivity? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-04 02:00 +0200
      Re: Interrupted system call on read after ~20 minutes inactivity? Alan Bawden <alan@csail.mit.edu> - 2025-10-03 20:26 -0400
        Re: Interrupted system call on read after ~20 minutes inactivity? richard@cogsci.ed.ac.uk (Richard Tobin) - 2025-10-05 11:39 +0000
          Re: Interrupted system call on read after ~20 minutes inactivity? Alan Bawden <alan@csail.mit.edu> - 2025-10-06 04:05 -0400
            Re: Interrupted system call on read after ~20 minutes inactivity? richard@cogsci.ed.ac.uk (Richard Tobin) - 2025-10-06 10:46 +0000
            Re: Interrupted system call on read after ~20 minutes inactivity? Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-06 22:04 +0000
  Re: Interrupted system call on read after ~20 minutes inactivity? richard@cogsci.ed.ac.uk (Richard Tobin) - 2025-10-04 00:18 +0000
    Re: Interrupted system call on read after ~20 minutes inactivity? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-04 02:27 +0200
    Re: Interrupted system call on read after ~20 minutes inactivity? scott@slp53.sl.home (Scott Lurndal) - 2025-10-04 02:13 +0000
    Re: Interrupted system call on read after ~20 minutes inactivity? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-10-05 11:43 -0700
  Re: Interrupted system call on read after ~20 minutes inactivity? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-07 16:29 +0200

csiph-web