From owner-p4-projects@FreeBSD.ORG Mon Jun 26 18:21:35 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 72F0C16A4CE; Mon, 26 Jun 2006 18:21:35 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 34C3616A4CB for ; Mon, 26 Jun 2006 18:21:35 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7C07444B30 for ; Mon, 26 Jun 2006 18:20:56 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5QIKuhA004654 for ; Mon, 26 Jun 2006 18:20:56 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5QIKuJ5004651 for perforce@freebsd.org; Mon, 26 Jun 2006 18:20:56 GMT (envelope-from jhb@freebsd.org) Date: Mon, 26 Jun 2006 18:20:56 GMT Message-Id: <200606261820.k5QIKuJ5004651@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 100078 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jun 2006 18:21:35 -0000 http://perforce.freebsd.org/chv.cgi?CH=100078 Change 100078 by jhb@jhb_mutex on 2006/06/26 18:20:06 Just call obreak(). Discussed with: alc Affected files ... .. //depot/projects/smpng/sys/compat/svr4/svr4_misc.c#46 edit Differences ... ==== //depot/projects/smpng/sys/compat/svr4/svr4_misc.c#46 (text+ko) ==== @@ -792,69 +792,10 @@ struct thread *td; struct svr4_sys_break_args *uap; { - struct proc *p = td->td_proc; - struct vmspace *vm = p->p_vmspace; - vm_offset_t new, old, base, ns; - rlim_t datalim, vmemlim; - int error, rv; + struct obreak_args ap; - PROC_LOCK(p); - datalim = lim_cur(p, RLIMIT_DATA); - vmemlim = lim_cur(p, RLIMIT_VMEM); - PROC_UNLOCK(p); - - base = round_page((vm_offset_t) vm->vm_daddr); - ns = (vm_offset_t)uap->nsize; - new = round_page(ns); - error = 0; - vm_map_lock(&vm->vm_map); - if (new > base) { - if ((new - base) > (unsigned)datalim) { - error = ENOMEM; - goto done; - } - if (new > vm_map_max(&vm->vm_map)) { - error = ENOMEM; - goto done; - } - } else if (new < base) { - /* - * This is simply an invalid value. If someone wants to - * do fancy address space manipulations, mmap and munmap - * can do most of what the user would want. - */ - error = EINVAL; - goto done; - } - - old = base + ctob(vm->vm_dsize); - - if (new > old) { - vm_size_t diff; - diff = new - old; - if (vm->vm_map.size + diff > vmemlim) { - error = ENOMEM; - goto done; - } - rv = vm_map_find(&vm->vm_map, NULL, 0, &old, diff, FALSE, - VM_PROT_ALL, VM_PROT_ALL, 0); - if (rv != KERN_SUCCESS) { - error = ENOMEM; - goto done; - } - vm->vm_dsize += btoc(diff); - } else if (new < old) { - rv = vm_map_remove(&vm->vm_map, new, old); - if (rv != KERN_SUCCESS) { - error = ENOMEM; - goto done; - } - vm->vm_dsize -= btoc(old - new); - } -done: - vm_map_unlock(&vm->vm_map); - - return (error); + ap.nsize = uap->nsize; + return (obreak(td, &ap)); } static __inline clock_t