Ian T Zimmerman wrote:
> will hang when run on a Linux console (and not on an Xterm).
> Alternatively, just run the 'mev' example program on a Linux
> console and send it a SIGTSTP and it will also hang.
No it won't, not on my system (ix86, kernel 2.0.35, libc 5.4.44). Do
you use glibc? That may be the root of the trouble. Otherwise I'd
suspect the way you have compiled libgpm (maybe you added -D_USE_BSD?)
> The problem is here in (liblow.c):
>
> > #if (defined(SIGTSTP)) /* itz: support for SIGTSTP */
> First comment. Compare this handler with the way the SIGWINCH is
> relayed just above.
>
> > /* Old SIGTSTP handler. */
> > static __sighandler_t gpm_saved_suspend_hook;
> > static void gpm_suspend_hook (int signum)
> Note. Signal handlers installed with 'signal' are called with the
> signal that generated them blocked. It is then unblocked on exiting
> the signal handler.
>
No. Under ix86 Linux up to and including 2.0 (don't know about 2.1,
but I won't be fixing gpm to be compatible with a development kernel),
the signal syscall has AT&T Unix semantics - no masking, no queueing,
handler reset to default on delivery. The kernel code for sys_signal
in linux/kernel/signal.c adds SA_NOMASK to the flags, check yourself.
The system call is largely irrelevant, as libgpm isn't performing an
INT 80h. It's the library function which counts. libc-5 defaults to
signal() having SysV semantics, libc-6 defaults to BSD semantics.
Using signal() in anything other than a trivial program is asking for
porting headaches, IMHO. sigaction() is unambiguous, and is available
on virtually every Unix.
--
Glynn Clements <glynn(a)sensei.co.uk>