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 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #define _LARGEFILE64_SOURCE
32 #include <sys/types.h>
44 pr_getzoneid(struct ps_prochandle
*Pr
)
51 if (Pr
== NULL
) /* no subject process */
55 adp
->arg_value
= 6; /* switch for zone_lookup in zone */
56 adp
->arg_object
= NULL
;
57 adp
->arg_type
= AT_BYVAL
;
58 adp
->arg_inout
= AI_INPUT
;
62 adp
->arg_value
= 0; /* arguement for zone_lookup in zone */
63 adp
->arg_object
= NULL
;
64 adp
->arg_type
= AT_BYVAL
;
65 adp
->arg_inout
= AI_INPUT
;
68 error
= Psyscall(Pr
, &rval
, SYS_zone
, 2, &argd
[0]);
71 errno
= (error
> 0) ? error
: ENOSYS
;
74 return (rval
.sys_rval1
);
78 pr_getprojid(struct ps_prochandle
*Pr
)
85 if (Pr
== NULL
) /* no subject process */
89 adp
->arg_value
= 2; /* switch for getprojid in tasksys */
90 adp
->arg_object
= NULL
;
91 adp
->arg_type
= AT_BYVAL
;
92 adp
->arg_inout
= AI_INPUT
;
95 error
= Psyscall(Pr
, &rval
, SYS_tasksys
, 1, &argd
[0]);
98 errno
= (error
> 0) ? error
: ENOSYS
;
101 return (rval
.sys_rval1
);
105 pr_gettaskid(struct ps_prochandle
*Pr
)
112 if (Pr
== NULL
) /* no subject process */
113 return (gettaskid());
116 adp
->arg_value
= 1; /* switch for gettaskid in tasksys */
117 adp
->arg_object
= NULL
;
118 adp
->arg_type
= AT_BYVAL
;
119 adp
->arg_inout
= AI_INPUT
;
122 error
= Psyscall(Pr
, &rval
, SYS_tasksys
, 1, &argd
[0]);
125 errno
= (error
> 0) ? error
: ENOSYS
;
128 return (rval
.sys_rval1
);
132 pr_settaskid(struct ps_prochandle
*Pr
, projid_t project
, int flags
)
139 if (Pr
== NULL
) /* No subject process */
140 return (settaskid(project
, flags
));
143 adp
->arg_value
= 0; /* switch for settaskid in tasksys */
144 adp
->arg_object
= NULL
;
145 adp
->arg_type
= AT_BYVAL
;
146 adp
->arg_inout
= AI_INPUT
;
150 adp
->arg_value
= project
;
151 adp
->arg_object
= NULL
;
152 adp
->arg_type
= AT_BYVAL
;
153 adp
->arg_inout
= AI_INPUT
;
154 adp
->arg_size
= sizeof (project
);
157 adp
->arg_value
= flags
;
158 adp
->arg_object
= NULL
;
159 adp
->arg_type
= AT_BYVAL
;
160 adp
->arg_inout
= AI_INPUT
;
163 error
= Psyscall(Pr
, &rval
, SYS_tasksys
, 3, &argd
[0]);
166 errno
= (error
> 0) ? error
: ENOSYS
;
169 return (rval
.sys_rval1
);