Deleted Added
full compact
kern_resource.c (96886) kern_resource.c (99012)
1/*-
2 * Copyright (c) 1982, 1986, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

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

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94
1/*-
2 * Copyright (c) 1982, 1986, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

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

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94
39 * $FreeBSD: head/sys/kern/kern_resource.c 96886 2002-05-19 00:14:50Z jhb $
39 * $FreeBSD: head/sys/kern/kern_resource.c 99012 2002-06-29 02:00:02Z alfred $
40 */
41
42#include "opt_compat.h"
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/sysproto.h>
47#include <sys/file.h>

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

421osetrlimit(td, uap)
422 struct thread *td;
423 register struct osetrlimit_args *uap;
424{
425 struct orlimit olim;
426 struct rlimit lim;
427 int error;
428
40 */
41
42#include "opt_compat.h"
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/sysproto.h>
47#include <sys/file.h>

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

421osetrlimit(td, uap)
422 struct thread *td;
423 register struct osetrlimit_args *uap;
424{
425 struct orlimit olim;
426 struct rlimit lim;
427 int error;
428
429 if ((error =
430 copyin((caddr_t)uap->rlp, (caddr_t)&olim, sizeof(struct orlimit))))
429 if ((error = copyin(uap->rlp, &olim, sizeof(struct orlimit))))
431 return (error);
432 lim.rlim_cur = olim.rlim_cur;
433 lim.rlim_max = olim.rlim_max;
434 mtx_lock(&Giant);
435 error = dosetrlimit(td, uap->which, &lim);
436 mtx_unlock(&Giant);
437 return (error);
438}

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

460 return (EINVAL);
461 mtx_lock(&Giant);
462 olim.rlim_cur = p->p_rlimit[uap->which].rlim_cur;
463 if (olim.rlim_cur == -1)
464 olim.rlim_cur = 0x7fffffff;
465 olim.rlim_max = p->p_rlimit[uap->which].rlim_max;
466 if (olim.rlim_max == -1)
467 olim.rlim_max = 0x7fffffff;
430 return (error);
431 lim.rlim_cur = olim.rlim_cur;
432 lim.rlim_max = olim.rlim_max;
433 mtx_lock(&Giant);
434 error = dosetrlimit(td, uap->which, &lim);
435 mtx_unlock(&Giant);
436 return (error);
437}

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

459 return (EINVAL);
460 mtx_lock(&Giant);
461 olim.rlim_cur = p->p_rlimit[uap->which].rlim_cur;
462 if (olim.rlim_cur == -1)
463 olim.rlim_cur = 0x7fffffff;
464 olim.rlim_max = p->p_rlimit[uap->which].rlim_max;
465 if (olim.rlim_max == -1)
466 olim.rlim_max = 0x7fffffff;
468 error = copyout((caddr_t)&olim, (caddr_t)uap->rlp, sizeof(olim));
467 error = copyout(&olim, uap->rlp, sizeof(olim));
469 mtx_unlock(&Giant);
470 return (error);
471}
472#endif /* COMPAT_43 || COMPAT_SUNOS */
473
474#ifndef _SYS_SYSPROTO_H_
475struct __setrlimit_args {
476 u_int which;

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

484int
485setrlimit(td, uap)
486 struct thread *td;
487 register struct __setrlimit_args *uap;
488{
489 struct rlimit alim;
490 int error;
491
468 mtx_unlock(&Giant);
469 return (error);
470}
471#endif /* COMPAT_43 || COMPAT_SUNOS */
472
473#ifndef _SYS_SYSPROTO_H_
474struct __setrlimit_args {
475 u_int which;

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

483int
484setrlimit(td, uap)
485 struct thread *td;
486 register struct __setrlimit_args *uap;
487{
488 struct rlimit alim;
489 int error;
490
492 if ((error =
493 copyin((caddr_t)uap->rlp, (caddr_t)&alim, sizeof (struct rlimit))))
491 if ((error = copyin(uap->rlp, &alim, sizeof (struct rlimit))))
494 return (error);
495 mtx_lock(&Giant);
496 error = dosetrlimit(td, uap->which, &alim);
497 mtx_unlock(&Giant);
498 return (error);
499}
500
501int

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

620 register struct __getrlimit_args *uap;
621{
622 int error;
623 struct proc *p = td->td_proc;
624
625 if (uap->which >= RLIM_NLIMITS)
626 return (EINVAL);
627 mtx_lock(&Giant);
492 return (error);
493 mtx_lock(&Giant);
494 error = dosetrlimit(td, uap->which, &alim);
495 mtx_unlock(&Giant);
496 return (error);
497}
498
499int

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

618 register struct __getrlimit_args *uap;
619{
620 int error;
621 struct proc *p = td->td_proc;
622
623 if (uap->which >= RLIM_NLIMITS)
624 return (EINVAL);
625 mtx_lock(&Giant);
628 error = copyout((caddr_t)&p->p_rlimit[uap->which], (caddr_t)uap->rlp,
626 error = copyout(&p->p_rlimit[uap->which], uap->rlp,
629 sizeof (struct rlimit));
630 mtx_unlock(&Giant);
631 return(error);
632}
633
634/*
635 * Transform the running time and tick information in proc p into user,
636 * system, and interrupt time usage.

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

774
775 default:
776 rup = NULL;
777 error = EINVAL;
778 break;
779 }
780 mtx_unlock(&Giant);
781 if (error == 0) {
627 sizeof (struct rlimit));
628 mtx_unlock(&Giant);
629 return(error);
630}
631
632/*
633 * Transform the running time and tick information in proc p into user,
634 * system, and interrupt time usage.

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

772
773 default:
774 rup = NULL;
775 error = EINVAL;
776 break;
777 }
778 mtx_unlock(&Giant);
779 if (error == 0) {
782 error = copyout((caddr_t)rup, (caddr_t)uap->rusage,
783 sizeof (struct rusage));
780 error = copyout(rup, uap->rusage, sizeof (struct rusage));
784 }
785 return(error);
786}
787
788void
789ruadd(ru, ru2)
790 register struct rusage *ru, *ru2;
791{

--- 229 unchanged lines hidden ---
781 }
782 return(error);
783}
784
785void
786ruadd(ru, ru2)
787 register struct rusage *ru, *ru2;
788{

--- 229 unchanged lines hidden ---