[comp.unix.aix] read ignores SIGINTR

kevin@msa3b.UUCP (Kevin P. Kleinfelter) (10/20/89)

I vaguely recall seeing something about this in the doc, but I'll be darned if
I can find it again:

I have a "read(2)" call in a ported program.  DEL is defined as the "intr"
key.  The program has an exception handler for the SIGINT interrupt.
When the read call is executed, I hit DEL, and the interrupt handler is NOT
executed.  Then I hit RETURN, and the signal handler IS executed.
I don't think the terminal is in RAW mode, because the signal handler is
executed once the newline is read.  I THINK this has to do with AIX
retrying reads on interrupts.  I KNOW I have read something about how
to make reads of the terminal behave more like SYSV reads, and not do
this retry.  This is NOT the way ALL reads behave on AIX, as code I have
written myself handles the interrupt immediately.  The REALLY odd thing is
that when I had my serial ports defined incorrectly (via devices) /bin/sh
behaved this way! (Now it does not.)

How do I make my read be in cooked mode (to allow backspace processing)
and receive signals such as SIGINT immediately?
-- 
Kevin Kleinfelter @ Management Science America, Inc (404) 239-2347
gatech!nanovx!msa3b!kevin

jon@jonlab.UUCP (Jon H. LaBadie) (10/23/89)

For starts, let me say I have not mucked around in the AIX kernel;
I have played with the System V kernel and my comments are based on
that experience.

In article <1162@msa3b.UUCP>, kevin@msa3b.UUCP (Kevin P. Kleinfelter) writes:
> I have a "read(2)" call in a ported program.  DEL is defined as the "intr"
> key.  The program has an exception handler for the SIGINT interrupt.
> When the read call is executed, I hit DEL, and the interrupt handler is NOT
> executed.  Then I hit RETURN, and the signal handler IS executed.
> I don't think the terminal is in RAW mode, because the signal handler is
> executed once the newline is read. ...

When a process executes a system call and enters a sleep state, the
process priority is set to a high priority level, typically between
1 and 40 (low numerically, high priority).  Within this range, two
sub-ranges exist, interuptable and non-interuptable.  Typically they
are 1-25 (non-interuptable) and 26-40 (interuptable).  Non-interuptable
priorities are used for those types of events that are pretty certain
to finish quickly.  For example, disk I/O.  Interuptable priorities are
assigned to those events that have less certain completions; for example
terminal I/O - humans can be so SSLLOOWW..

System calls at a non-interuptable only check for signals upon entry and
exit from the system call.  Your description (interupt handler invoked
upon hitting RETURN, not the DEL key) sounds like terminal I/O under AIX
is not interuptable.  Thus, signals pending would only be checked upon
exit from the system call.

> How do I make my read be in cooked mode (to allow backspace processing)
> and receive signals such as SIGINT immediately?

Now this is a different question!  Investigate "cbreak" mode to allow
cannonical processing.  It is kind of like not "raw", not "cooked",
but "rare" terminal I/O.

-- 
Jon LaBadie
{att, princeton, bcr}!jonlab!jon
{att, attmail, bcr}!auxnj!jon