trap.c (194127) | trap.c (199205) |
---|---|
1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 22 unchanged lines hidden (view full) --- 31 */ 32 33#ifndef lint 34#if 0 35static char sccsid[] = "@(#)trap.c 8.5 (Berkeley) 6/5/95"; 36#endif 37#endif /* not lint */ 38#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 22 unchanged lines hidden (view full) --- 31 */ 32 33#ifndef lint 34#if 0 35static char sccsid[] = "@(#)trap.c 8.5 (Berkeley) 6/5/95"; 36#endif 37#endif /* not lint */ 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/bin/sh/trap.c 194127 2009-06-13 21:10:41Z jilles $"); | 39__FBSDID("$FreeBSD: head/bin/sh/trap.c 199205 2009-11-11 23:13:24Z jilles $"); |
40 41#include <signal.h> 42#include <unistd.h> 43#include <stdlib.h> 44 45#include "shell.h" 46#include "main.h" 47#include "nodes.h" /* for other headers */ --- 191 unchanged lines hidden (view full) --- 239/* 240 * Set the signal handler for the specified signal. The routine figures 241 * out what it should be set to. 242 */ 243void 244setsignal(int signo) 245{ 246 int action; | 40 41#include <signal.h> 42#include <unistd.h> 43#include <stdlib.h> 44 45#include "shell.h" 46#include "main.h" 47#include "nodes.h" /* for other headers */ --- 191 unchanged lines hidden (view full) --- 239/* 240 * Set the signal handler for the specified signal. The routine figures 241 * out what it should be set to. 242 */ 243void 244setsignal(int signo) 245{ 246 int action; |
247 sig_t sig, sigact = SIG_DFL; | 247 sig_t sigact = SIG_DFL; 248 struct sigaction sa; |
248 char *t; 249 250 if ((t = trap[signo]) == NULL) 251 action = S_DFL; 252 else if (*t != '\0') 253 action = S_CATCH; 254 else 255 action = S_IGN; --- 59 unchanged lines hidden (view full) --- 315 if (*t == S_HARD_IGN || *t == action) 316 return; 317 switch (action) { 318 case S_DFL: sigact = SIG_DFL; break; 319 case S_CATCH: sigact = onsig; break; 320 case S_IGN: sigact = SIG_IGN; break; 321 } 322 *t = action; | 249 char *t; 250 251 if ((t = trap[signo]) == NULL) 252 action = S_DFL; 253 else if (*t != '\0') 254 action = S_CATCH; 255 else 256 action = S_IGN; --- 59 unchanged lines hidden (view full) --- 316 if (*t == S_HARD_IGN || *t == action) 317 return; 318 switch (action) { 319 case S_DFL: sigact = SIG_DFL; break; 320 case S_CATCH: sigact = onsig; break; 321 case S_IGN: sigact = SIG_IGN; break; 322 } 323 *t = action; |
323 sig = signal(signo, sigact); 324 if (sig != SIG_ERR && action == S_CATCH) 325 siginterrupt(signo, 1); | 324 sa.sa_handler = sigact; 325 sa.sa_flags = 0; 326 sigemptyset(&sa.sa_mask); 327 sigaction(signo, &sa, NULL); |
326} 327 328 329/* 330 * Return the current setting for sig w/o changing it. 331 */ 332static int 333getsigaction(int signo, sig_t *sigact) --- 164 unchanged lines hidden --- | 328} 329 330 331/* 332 * Return the current setting for sig w/o changing it. 333 */ 334static int 335getsigaction(int signo, sig_t *sigact) --- 164 unchanged lines hidden --- |