122111Smckusick /* 2*38790Skarels * Copyright (c) 1985, 1989 Regents of the University of California. 335307Sbostic * All rights reserved. 435307Sbostic * 535307Sbostic * Redistribution and use in source and binary forms are permitted 635307Sbostic * provided that the above copyright notice and this paragraph are 735307Sbostic * duplicated in all such forms and that any documentation, 835307Sbostic * advertising materials, and other materials related to such 935307Sbostic * distribution and use acknowledge that the software was developed 1035307Sbostic * by the University of California, Berkeley. The name of the 1135307Sbostic * University may not be used to endorse or promote products derived 1235307Sbostic * from this software without specific prior written permission. 1335307Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 1435307Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 1535307Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1622111Smckusick */ 1718296Smckusick 1826592Sdonn #if defined(LIBC_SCCS) && !defined(lint) 19*38790Skarels static char sccsid[] = "@(#)signal.c 5.4 (Berkeley) 08/26/89"; 2035307Sbostic #endif /* LIBC_SCCS and not lint */ 2122111Smckusick 2216498Sralph /* 2316498Sralph * Almost backwards compatible signal. 2416498Sralph */ 2518296Smckusick #include <signal.h> 2616498Sralph 27*38790Skarels sigset_t _sigintr; /* shared with siginterrupt */ 28*38790Skarels 29*38790Skarels sig_t 30*38790Skarels signal(s, a) 31*38790Skarels int s; 32*38790Skarels sig_t a; 3318296Smckusick { 34*38790Skarels struct sigaction sa, osa; 3518296Smckusick 36*38790Skarels sa.sa_handler = a; 37*38790Skarels sigemptyset(&sa.sa_mask); 38*38790Skarels sa.sa_flags = 0; 39*38790Skarels if (!sigismember(&_sigintr, s)) 40*38790Skarels sa.sa_flags |= SA_RESTART; 41*38790Skarels if (sigaction(s, &sa, &osa) < 0) 4218296Smckusick return (BADSIG); 43*38790Skarels return (osa.sa_handler); 4418296Smckusick } 45