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) 1997-2000 by Sun Microsystems, Inc.
24 * All rights reserved.
30 #include <sys/resource.h>
34 * getrlimit() system call -- executed by subject process.
37 pr_getrlimit(struct ps_prochandle
*Pr
,
38 int resource
, struct rlimit
*rlp
)
40 sysret_t rval
; /* return value from getrlimit() */
41 argdes_t argd
[2]; /* arg descriptors for getrlimit() */
46 if (Pr
== NULL
) /* no subject process */
47 return (getrlimit(resource
, rlp
));
49 adp
= &argd
[0]; /* resource argument */
50 adp
->arg_value
= resource
;
51 adp
->arg_object
= NULL
;
52 adp
->arg_type
= AT_BYVAL
;
53 adp
->arg_inout
= AI_INPUT
;
56 adp
++; /* rlp argument */
58 adp
->arg_object
= rlp
;
59 adp
->arg_type
= AT_BYREF
;
60 adp
->arg_inout
= AI_OUTPUT
;
61 adp
->arg_size
= sizeof (*rlp
);
63 sysnum
= SYS_getrlimit
;
65 error
= Psyscall(Pr
, &rval
, sysnum
, 2, &argd
[0]);
68 errno
= (error
> 0)? error
: ENOSYS
;
71 return (rval
.sys_rval1
);
75 * setrlimit() system call -- executed by subject process.
78 pr_setrlimit(struct ps_prochandle
*Pr
,
79 int resource
, const struct rlimit
*rlp
)
81 sysret_t rval
; /* return value from setrlimit() */
82 argdes_t argd
[2]; /* arg descriptors for setrlimit() */
87 if (Pr
== NULL
) /* no subject process */
88 return (setrlimit(resource
, rlp
));
90 adp
= &argd
[0]; /* resource argument */
91 adp
->arg_value
= resource
;
92 adp
->arg_object
= NULL
;
93 adp
->arg_type
= AT_BYVAL
;
94 adp
->arg_inout
= AI_INPUT
;
97 adp
++; /* rlp argument */
99 adp
->arg_object
= (void *)rlp
;
100 adp
->arg_type
= AT_BYREF
;
101 adp
->arg_inout
= AI_INPUT
;
102 adp
->arg_size
= sizeof (*rlp
);
104 sysnum
= SYS_setrlimit
;
106 error
= Psyscall(Pr
, &rval
, sysnum
, 2, &argd
[0]);
109 errno
= (error
> 0)? error
: ENOSYS
;
112 return (rval
.sys_rval1
);