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]
23 * Copyright 1997-2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <sys/isa_defs.h>
41 * sigaction() system call -- executed by subject process.
44 pr_sigaction(struct ps_prochandle
*Pr
,
45 int sig
, const struct sigaction
*act
, struct sigaction
*oact
)
47 sysret_t rval
; /* return value from sigaction() */
48 argdes_t argd
[3]; /* arg descriptors for sigaction() */
52 struct sigaction32 act32
;
53 struct sigaction32 oact32
;
56 if (Pr
== NULL
) /* no subject process */
57 return (sigaction(sig
, act
, oact
));
59 adp
= &argd
[0]; /* sig argument */
61 adp
->arg_object
= NULL
;
62 adp
->arg_type
= AT_BYVAL
;
63 adp
->arg_inout
= AI_INPUT
;
66 adp
++; /* act argument */
69 adp
->arg_type
= AT_BYVAL
;
70 adp
->arg_inout
= AI_INPUT
;
71 adp
->arg_object
= NULL
;
74 adp
->arg_type
= AT_BYREF
;
75 adp
->arg_inout
= AI_INPUT
;
77 if (Pstatus(Pr
)->pr_dmodel
== PR_MODEL_ILP32
) {
78 sigaction_n_to_32(act
, &act32
);
79 adp
->arg_object
= &act32
;
80 adp
->arg_size
= sizeof (act32
);
82 adp
->arg_object
= (void *)act
;
83 adp
->arg_size
= sizeof (*act
);
86 adp
->arg_object
= (void *)act
;
87 adp
->arg_size
= sizeof (*act
);
91 adp
++; /* oact argument */
94 adp
->arg_type
= AT_BYVAL
;
95 adp
->arg_inout
= AI_INPUT
;
96 adp
->arg_object
= NULL
;
99 adp
->arg_type
= AT_BYREF
;
100 adp
->arg_inout
= AI_OUTPUT
;
102 if (Pstatus(Pr
)->pr_dmodel
== PR_MODEL_ILP32
) {
103 adp
->arg_object
= &oact32
;
104 adp
->arg_size
= sizeof (oact32
);
106 adp
->arg_object
= oact
;
107 adp
->arg_size
= sizeof (*oact
);
110 adp
->arg_object
= oact
;
111 adp
->arg_size
= sizeof (*oact
);
115 error
= Psyscall(Pr
, &rval
, SYS_sigaction
, 3, &argd
[0]);
118 errno
= (error
> 0)? error
: ENOSYS
;
122 if (oact
!= NULL
&& Pstatus(Pr
)->pr_dmodel
== PR_MODEL_ILP32
)
123 sigaction_32_to_n(&oact32
, oact
);
125 return (rval
.sys_rval1
);