[comp.unix.questions] SysV Signals and System Calls

fred@athsys.uucp (Fred Cox) (09/23/88)

We have a large program initially written on suns, which we now need
to port to various System V machines.  The problem that we are coming
up with is that in BSD 4.2 systems, systems calls are not disturbed
by signals, while System V system calls return an error.  We need signals
for timer events.  What do people do in those cases where they are
using packages, like X Windows, which wait in system calls (read) while
signals may be occurring?

------------------------
Fred Cox, reachable at: sun!athsys!fred

marc@vangogh.Berkeley.EDU (Marc Teitelbaum) (09/23/88)

In article <149@poseidon.UUCP> fred%athsys.uucp@sun.com (Fred Cox) writes:
>We have a large program initially written on suns, which we now need
>to port to various System V machines.  The problem that we are coming
>up with is that in BSD 4.2 systems, systems calls are not disturbed
>by signals, while System V system calls return an error.  We need signals
>for timer events.  What do people do in those cases where they are
>using packages, like X Windows, which wait in system calls (read) while
>signals may be occurring?

Restart every interrupted system call yourself.

(sheesh - job control is going to a real surprise for POSIX implementations
which don't support restarted system calls)

Marc

-------------------------------
Marc Teitelbaum			+1-415-643-6448
457 Evans Hall
Computer Systems Research Group,  CSRG / DEC
University of California
Berkeley, CA 94720

quan@hplabsb.UUCP (Suu Quan) (09/24/88)

In article <149@poseidon.UUCP>, fred@athsys.uucp (Fred Cox) writes:
> We have a large program initially written on suns, which we now need
> to port to various System V machines.  The problem that we are coming
> up with is that in BSD 4.2 systems, systems calls are not disturbed
> by signals, while System V system calls return an error.  We need signals
> for timer events.  What do people do in those cases where they are
> using packages, like X Windows, which wait in system calls (read) while
> signals may be occurring?
> 
> ------------------------

The interrupt service routine should restart the system call :

#include <signal.h>

static int
interrupt_routine(signo, code, scp)
int signo, code;
register struct sigcontext *scp;
{  if (scp != NULL) scp->sc_syscall_action = SIG_RESTART;
   other_actions();
}