Deleted Added
full compact
svr4_resource.c (107839) svr4_resource.c (107849)
1/* Derived from:
2 * $NetBSD: svr4_resource.c,v 1.3 1998/12/13 18:00:52 christos Exp $
3 */
4
5/*-
6 * Original copyright:
7 *
8 * Copyright (c) 1998 The NetBSD Foundation, Inc.

--- 25 unchanged lines hidden (view full) ---

34 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
37 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
38 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
39 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40 * POSSIBILITY OF SUCH DAMAGE.
41 *
1/* Derived from:
2 * $NetBSD: svr4_resource.c,v 1.3 1998/12/13 18:00:52 christos Exp $
3 */
4
5/*-
6 * Original copyright:
7 *
8 * Copyright (c) 1998 The NetBSD Foundation, Inc.

--- 25 unchanged lines hidden (view full) ---

34 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
37 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
38 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
39 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40 * POSSIBILITY OF SUCH DAMAGE.
41 *
42 * $FreeBSD: head/sys/compat/svr4/svr4_resource.c 107839 2002-12-13 22:41:47Z alfred $
42 * $FreeBSD: head/sys/compat/svr4/svr4_resource.c 107849 2002-12-14 01:56:26Z alfred $
43 */
44
45/*
46 * Portions of this software have been derived from software contributed
47 * to the FreeBSD Project by Mark Newton.
48 *
49 * Copyright (c) 1999 Mark Newton
50 * All rights reserved.

--- 77 unchanged lines hidden (view full) ---

128 ((svr4_rlim64_t)(l)) != SVR4_RLIM64_SAVED_CUR && \
129 ((svr4_rlim64_t)(l)) != SVR4_RLIM64_SAVED_MAX)
130
131int
132svr4_sys_getrlimit(td, uap)
133 register struct thread *td;
134 struct svr4_sys_getrlimit_args *uap;
135{
43 */
44
45/*
46 * Portions of this software have been derived from software contributed
47 * to the FreeBSD Project by Mark Newton.
48 *
49 * Copyright (c) 1999 Mark Newton
50 * All rights reserved.

--- 77 unchanged lines hidden (view full) ---

128 ((svr4_rlim64_t)(l)) != SVR4_RLIM64_SAVED_CUR && \
129 ((svr4_rlim64_t)(l)) != SVR4_RLIM64_SAVED_MAX)
130
131int
132svr4_sys_getrlimit(td, uap)
133 register struct thread *td;
134 struct svr4_sys_getrlimit_args *uap;
135{
136 int rl = svr4_to_native_rl(SCARG(uap, which));
136 int rl = svr4_to_native_rl(uap->which);
137 struct rlimit blim;
138 struct svr4_rlimit slim;
139
140 if (rl == -1)
141 return EINVAL;
142
143 /* For p_rlimit. */
144 mtx_assert(&Giant, MA_OWNED);

--- 21 unchanged lines hidden (view full) ---

166 slim.rlim_cur = SVR4_RLIM_INFINITY;
167 else if (OKLIMIT(blim.rlim_cur))
168 slim.rlim_cur = (svr4_rlim_t) blim.rlim_cur;
169 else if (blim.rlim_max == blim.rlim_cur)
170 slim.rlim_cur = SVR4_RLIM_SAVED_MAX;
171 else
172 slim.rlim_cur = SVR4_RLIM_SAVED_CUR;
173
137 struct rlimit blim;
138 struct svr4_rlimit slim;
139
140 if (rl == -1)
141 return EINVAL;
142
143 /* For p_rlimit. */
144 mtx_assert(&Giant, MA_OWNED);

--- 21 unchanged lines hidden (view full) ---

166 slim.rlim_cur = SVR4_RLIM_INFINITY;
167 else if (OKLIMIT(blim.rlim_cur))
168 slim.rlim_cur = (svr4_rlim_t) blim.rlim_cur;
169 else if (blim.rlim_max == blim.rlim_cur)
170 slim.rlim_cur = SVR4_RLIM_SAVED_MAX;
171 else
172 slim.rlim_cur = SVR4_RLIM_SAVED_CUR;
173
174 return copyout(&slim, SCARG(uap, rlp), sizeof(*SCARG(uap, rlp)));
174 return copyout(&slim, uap->rlp, sizeof(*uap->rlp));
175}
176
177
178int
179svr4_sys_setrlimit(td, uap)
180 register struct thread *td;
181 struct svr4_sys_setrlimit_args *uap;
182{
175}
176
177
178int
179svr4_sys_setrlimit(td, uap)
180 register struct thread *td;
181 struct svr4_sys_setrlimit_args *uap;
182{
183 int rl = svr4_to_native_rl(SCARG(uap, which));
183 int rl = svr4_to_native_rl(uap->which);
184 struct rlimit blim, *limp;
185 struct svr4_rlimit slim;
186 int error;
187
188 if (rl == -1)
189 return EINVAL;
190
191 /* For p_rlimit. */
192 mtx_assert(&Giant, MA_OWNED);
193 limp = &td->td_proc->p_rlimit[rl];
194
184 struct rlimit blim, *limp;
185 struct svr4_rlimit slim;
186 int error;
187
188 if (rl == -1)
189 return EINVAL;
190
191 /* For p_rlimit. */
192 mtx_assert(&Giant, MA_OWNED);
193 limp = &td->td_proc->p_rlimit[rl];
194
195 if ((error = copyin(SCARG(uap, rlp), &slim, sizeof(slim))) != 0)
195 if ((error = copyin(uap->rlp, &slim, sizeof(slim))) != 0)
196 return error;
197
198 /*
199 * if the limit is SVR4_RLIM_INFINITY, then we set it to our
200 * unlimited.
201 * We should also: If it is SVR4_RLIM_SAVED_MAX, we should set the
202 * new limit to the corresponding saved hard limit, and if
203 * it is equal to SVR4_RLIM_SAVED_CUR, we should set it to the

--- 22 unchanged lines hidden (view full) ---

226}
227
228
229int
230svr4_sys_getrlimit64(td, uap)
231 register struct thread *td;
232 struct svr4_sys_getrlimit64_args *uap;
233{
196 return error;
197
198 /*
199 * if the limit is SVR4_RLIM_INFINITY, then we set it to our
200 * unlimited.
201 * We should also: If it is SVR4_RLIM_SAVED_MAX, we should set the
202 * new limit to the corresponding saved hard limit, and if
203 * it is equal to SVR4_RLIM_SAVED_CUR, we should set it to the

--- 22 unchanged lines hidden (view full) ---

226}
227
228
229int
230svr4_sys_getrlimit64(td, uap)
231 register struct thread *td;
232 struct svr4_sys_getrlimit64_args *uap;
233{
234 int rl = svr4_to_native_rl(SCARG(uap, which));
234 int rl = svr4_to_native_rl(uap->which);
235 struct rlimit blim;
236 struct svr4_rlimit64 slim;
237
238 if (rl == -1)
239 return EINVAL;
240
241 /* For p_rlimit. */
242 mtx_assert(&Giant, MA_OWNED);

--- 21 unchanged lines hidden (view full) ---

264 slim.rlim_cur = SVR4_RLIM64_INFINITY;
265 else if (OKLIMIT64(blim.rlim_cur))
266 slim.rlim_cur = (svr4_rlim64_t) blim.rlim_cur;
267 else if (blim.rlim_max == blim.rlim_cur)
268 slim.rlim_cur = SVR4_RLIM64_SAVED_MAX;
269 else
270 slim.rlim_cur = SVR4_RLIM64_SAVED_CUR;
271
235 struct rlimit blim;
236 struct svr4_rlimit64 slim;
237
238 if (rl == -1)
239 return EINVAL;
240
241 /* For p_rlimit. */
242 mtx_assert(&Giant, MA_OWNED);

--- 21 unchanged lines hidden (view full) ---

264 slim.rlim_cur = SVR4_RLIM64_INFINITY;
265 else if (OKLIMIT64(blim.rlim_cur))
266 slim.rlim_cur = (svr4_rlim64_t) blim.rlim_cur;
267 else if (blim.rlim_max == blim.rlim_cur)
268 slim.rlim_cur = SVR4_RLIM64_SAVED_MAX;
269 else
270 slim.rlim_cur = SVR4_RLIM64_SAVED_CUR;
271
272 return copyout(&slim, SCARG(uap, rlp), sizeof(*SCARG(uap, rlp)));
272 return copyout(&slim, uap->rlp, sizeof(*uap->rlp));
273}
274
275
276int
277svr4_sys_setrlimit64(td, uap)
278 register struct thread *td;
279 struct svr4_sys_setrlimit64_args *uap;
280{
273}
274
275
276int
277svr4_sys_setrlimit64(td, uap)
278 register struct thread *td;
279 struct svr4_sys_setrlimit64_args *uap;
280{
281 int rl = svr4_to_native_rl(SCARG(uap, which));
281 int rl = svr4_to_native_rl(uap->which);
282 struct rlimit blim, *limp;
283 struct svr4_rlimit64 slim;
284 int error;
285
286 if (rl == -1)
287 return EINVAL;
288
289 /* For p_rlimit. */
290 mtx_assert(&Giant, MA_OWNED);
291 limp = &td->td_proc->p_rlimit[rl];
292
282 struct rlimit blim, *limp;
283 struct svr4_rlimit64 slim;
284 int error;
285
286 if (rl == -1)
287 return EINVAL;
288
289 /* For p_rlimit. */
290 mtx_assert(&Giant, MA_OWNED);
291 limp = &td->td_proc->p_rlimit[rl];
292
293 if ((error = copyin(SCARG(uap, rlp), &slim, sizeof(slim))) != 0)
293 if ((error = copyin(uap->rlp, &slim, sizeof(slim))) != 0)
294 return error;
295
296 /*
297 * if the limit is SVR4_RLIM64_INFINITY, then we set it to our
298 * unlimited.
299 * We should also: If it is SVR4_RLIM64_SAVED_MAX, we should set the
300 * new limit to the corresponding saved hard limit, and if
301 * it is equal to SVR4_RLIM64_SAVED_CUR, we should set it to the

--- 23 unchanged lines hidden ---
294 return error;
295
296 /*
297 * if the limit is SVR4_RLIM64_INFINITY, then we set it to our
298 * unlimited.
299 * We should also: If it is SVR4_RLIM64_SAVED_MAX, we should set the
300 * new limit to the corresponding saved hard limit, and if
301 * it is equal to SVR4_RLIM64_SAVED_CUR, we should set it to the

--- 23 unchanged lines hidden ---