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 (c) 1998-2001 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/types.h>
37 * memcntl() system call -- executed by subject process
41 pr_memcntl(struct ps_prochandle
*Pr
,
42 caddr_t addr
, size_t len
, int cmd
, caddr_t arg
, int attr
, int mask
)
44 sysret_t rval
; /* return value from memcntl() */
45 argdes_t argd
[6]; /* arg descriptors for memcntl() */
49 if (Pr
== NULL
) /* no subject process */
50 return (memcntl(addr
, len
, cmd
, arg
, attr
, mask
));
52 adp
= &argd
[0]; /* addr argument */
53 adp
->arg_value
= (uintptr_t)addr
;
54 adp
->arg_object
= NULL
;
55 adp
->arg_type
= AT_BYVAL
;
56 adp
->arg_inout
= AI_INPUT
;
59 adp
++; /* len argument */
61 adp
->arg_object
= NULL
;
62 adp
->arg_type
= AT_BYVAL
;
63 adp
->arg_inout
= AI_INPUT
;
66 adp
++; /* cmd argument */
68 adp
->arg_object
= NULL
;
69 adp
->arg_type
= AT_BYVAL
;
70 adp
->arg_inout
= AI_INPUT
;
73 adp
++; /* arg argument */
74 if (cmd
== MC_HAT_ADVISE
) {
76 adp
->arg_object
= arg
;
77 adp
->arg_type
= AT_BYREF
;
78 adp
->arg_inout
= AI_INPUT
;
80 if (Pstatus(Pr
)->pr_dmodel
== PR_MODEL_ILP32
)
81 adp
->arg_size
= sizeof (struct memcntl_mha32
);
83 adp
->arg_size
= sizeof (struct memcntl_mha
);
85 adp
->arg_size
= sizeof (struct memcntl_mha
);
88 adp
->arg_value
= (uintptr_t)arg
;
89 adp
->arg_object
= NULL
;
90 adp
->arg_type
= AT_BYVAL
;
91 adp
->arg_inout
= AI_INPUT
;
95 adp
++; /* attr argument */
96 adp
->arg_value
= attr
;
97 adp
->arg_object
= NULL
;
98 adp
->arg_type
= AT_BYVAL
;
99 adp
->arg_inout
= AI_INPUT
;
102 adp
++; /* mask argument */
103 adp
->arg_value
= mask
;
104 adp
->arg_object
= NULL
;
105 adp
->arg_type
= AT_BYVAL
;
106 adp
->arg_inout
= AI_INPUT
;
109 error
= Psyscall(Pr
, &rval
, SYS_memcntl
, 6, &argd
[0]);
112 errno
= (error
> 0)? error
: ENOSYS
;