4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
29 #include <sys/param.h>
30 #include <sys/types.h>
31 #include <sys/sysmacros.h>
32 #include <sys/systm.h>
33 #include <sys/errno.h>
35 #include <sys/fault.h>
36 #include <sys/signal.h>
37 #include <sys/schedctl.h>
38 #include <sys/debug.h>
42 lwp_sigmask(int how
, uint_t bits0
, uint_t bits1
, uint_t bits2
, uint_t bits3
)
44 kthread_t
*t
= curthread
;
45 proc_t
*p
= ttoproc(t
);
49 * We don't need to acquire p->p_lock here;
50 * we are manipulating thread-private data.
53 schedctl_finish_sigblock(t
);
55 bits0
&= (FILLSET0
& ~CANTMASK0
);
56 bits1
&= (FILLSET1
& ~CANTMASK1
);
57 bits2
&= (FILLSET2
& ~CANTMASK2
);
60 * As a sop to the s10 brand, we continue to return
61 * the first two words of the signal mask, regardless
62 * of the value of 'how', even though libc doesn't use them.
64 rv
.r_val1
= t
->t_hold
.__sigbits
[0];
65 rv
.r_val2
= t
->t_hold
.__sigbits
[1];
69 t
->t_hold
.__sigbits
[0] |= bits0
;
70 t
->t_hold
.__sigbits
[1] |= bits1
;
71 t
->t_hold
.__sigbits
[2] |= bits2
;
74 t
->t_hold
.__sigbits
[0] &= ~bits0
;
75 t
->t_hold
.__sigbits
[1] &= ~bits1
;
76 t
->t_hold
.__sigbits
[2] &= ~bits2
;
81 t
->t_hold
.__sigbits
[0] = bits0
;
82 t
->t_hold
.__sigbits
[1] = bits1
;
83 t
->t_hold
.__sigbits
[2] = bits2
;
93 sigprocmask(int how
, sigset_t
*setp
, sigset_t
*osetp
)
100 * User's osetp and setp might be the same address,
101 * so copyin first and save before copying out.
110 return (set_errno(EINVAL
));
112 if (copyin((caddr_t
)setp
, (caddr_t
)&set
, sizeof (sigset_t
)))
113 return (set_errno(EFAULT
));
114 sigutok(&set
, &kset
);
118 sigktou(&curthread
->t_hold
, &oset
);
119 if (copyout((caddr_t
)&oset
, (caddr_t
)osetp
, sizeof (sigset_t
)))
120 return (set_errno(EFAULT
));
124 (void) lwp_sigmask(how
,