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"
34 * Convenience wrapper to set the cred attributes of a victim process
35 * to a set of new values. Caller must supply a prochandle and a
36 * fully populated prcred structure.
39 Psetcred(struct ps_prochandle
*Pr
, const prcred_t
*credp
)
48 if (Pr
== NULL
|| credp
== NULL
)
51 ngrp
= credp
->pr_ngroups
;
52 ctlsize
= sizeof (prcred_t
) + (ngrp
- 1) * sizeof (gid_t
);
53 ctlp
= alloca(ctlsize
+ sizeof (long));
56 (void) memcpy(&ctlp
->cred
, credp
, ctlsize
);
58 if (write(Pctlfd(Pr
), ctlp
, sizeof (long) + ctlsize
) < 0)
65 * Convenience wrapper to set the zoneid attribute of a victim process to a new
66 * value (only to and from GLOBAL_ZONEID makes sense). Caller must supply a
67 * prochandle and a valid zoneid.
70 Psetzoneid(struct ps_prochandle
*Pr
, zoneid_t zoneid
)
83 if (write(Pctlfd(Pr
), &ctl
, sizeof (ctl
)) < 0)