4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 #pragma ident "%Z%%M% %I% %E% SMI"
25 * Copyright (c) 1987 Sun Microsystems, Inc.
29 #include <sys/signal.h>
38 return (-1); /* sigblock quietly disallows SIGKILL */
40 (void) sigblock(sigmask(sig
));
41 return (0); /* SVID specifies 0 return on success */
51 return (-1); /* sigsetmask quietly disallows SIGKILL */
53 (void) sigsetmask(sigblock(0) & ~sigmask(sig
));
54 return (0); /* SVID specifies 0 return on success */
65 return (-1); /* sigsetmask quietly disallows SIGKILL */
67 if (sigvec(sig
, (struct sigvec
*)0, &vec
) < 0)
69 vec
.sv_handler
= SIG_IGN
;
70 if (sigvec(sig
, &vec
, (struct sigvec
*)0) < 0)
72 (void) sigsetmask(sigblock(0) & ~sigmask(sig
));
73 return (0); /* SVID specifies 0 return on success */
86 if (sigvec(sig
, (struct sigvec
*)0, &oldvec
) < 0)
88 oldmask
= sigblock(0);
90 newvec
.sv_flags
|= SV_INTERRUPT
;
91 newvec
.sv_flags
&= ~SV_RESETHAND
;
94 if (func
== SIG_HOLD
) {
96 * Signal will be held. Set the bit for that
97 * signal in the signal mask. Leave the action
100 newmask
|= sigmask(sig
);
103 * Signal will not be held. Clear the bit
104 * for it in the signal mask. Set the action
107 newmask
&= ~sigmask(sig
);
108 newvec
.sv_handler
= func
;
110 if (sigvec(sig
, &newvec
, (struct sigvec
*)0) < 0)
112 if (sigsetmask(newmask
) < 0)
114 if (oldmask
& sigmask(sig
))
115 return (SIG_HOLD
); /* signal was held */
117 return (oldvec
.sv_handler
);