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 2008 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>
35 #include <sys/types.h>
42 * waitid() system call -- executed by subject process
45 pr_waitid(struct ps_prochandle
*Pr
,
46 idtype_t idtype
, id_t id
, siginfo_t
*infop
, int options
)
48 sysret_t rval
; /* return value from waitid() */
49 argdes_t argd
[4]; /* arg descriptors for waitid() */
53 siginfo32_t siginfo32
;
56 if (Pr
== NULL
) /* no subject process */
57 return (waitid(idtype
, id
, infop
, options
));
59 adp
= &argd
[0]; /* idtype argument */
60 adp
->arg_value
= idtype
;
61 adp
->arg_object
= NULL
;
62 adp
->arg_type
= AT_BYVAL
;
63 adp
->arg_inout
= AI_INPUT
;
66 adp
++; /* id argument */
68 adp
->arg_object
= NULL
;
69 adp
->arg_type
= AT_BYVAL
;
70 adp
->arg_inout
= AI_INPUT
;
73 adp
++; /* infop argument */
75 adp
->arg_type
= AT_BYREF
;
76 adp
->arg_inout
= AI_OUTPUT
;
78 if (Pstatus(Pr
)->pr_dmodel
== PR_MODEL_ILP32
) {
79 adp
->arg_object
= &siginfo32
;
80 adp
->arg_size
= sizeof (siginfo32
);
82 adp
->arg_object
= infop
;
83 adp
->arg_size
= sizeof (*infop
);
86 adp
->arg_object
= infop
;
87 adp
->arg_size
= sizeof (*infop
);
90 adp
++; /* options argument */
91 adp
->arg_value
= options
;
92 adp
->arg_object
= NULL
;
93 adp
->arg_type
= AT_BYVAL
;
94 adp
->arg_inout
= AI_INPUT
;
97 error
= Psyscall(Pr
, &rval
, SYS_waitid
, 4, &argd
[0]);
100 errno
= (error
> 0)? error
: ENOSYS
;
104 if (Pstatus(Pr
)->pr_dmodel
== PR_MODEL_ILP32
)
105 siginfo_32_to_n(&siginfo32
, infop
);