1 /* 2 * Copyright (c) 1985, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #if defined(LIBC_SCCS) && !defined(lint) 9 static char sccsid[] = "@(#)signal.c 8.1 (Berkeley) 06/04/93"; 10 #endif /* LIBC_SCCS and not lint */ 11 12 /* 13 * Almost backwards compatible signal. 14 */ 15 #include <signal.h> 16 17 sigset_t _sigintr; /* shared with siginterrupt */ 18 19 sig_t 20 signal(s, a) 21 int s; 22 sig_t a; 23 { 24 struct sigaction sa, osa; 25 26 sa.sa_handler = a; 27 sigemptyset(&sa.sa_mask); 28 sa.sa_flags = 0; 29 if (!sigismember(&_sigintr, s)) 30 sa.sa_flags |= SA_RESTART; 31 if (sigaction(s, &sa, &osa) < 0) 32 return (SIG_ERR); 33 return (osa.sa_handler); 34 } 35