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 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 |
429 if ((error = copyin(uap->rlp, &olim, sizeof(struct orlimit)))) |
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; |
467 error = copyout(&olim, uap->rlp, sizeof(olim)); |
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 |
491 if ((error = copyin(uap->rlp, &alim, sizeof (struct rlimit)))) |
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); |
626 error = copyout(&p->p_rlimit[uap->which], uap->rlp, |
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) { |
780 error = copyout(rup, uap->rusage, sizeof (struct rusage)); |
781 } 782 return(error); 783} 784 785void 786ruadd(ru, ru2) 787 register struct rusage *ru, *ru2; 788{ --- 229 unchanged lines hidden --- |