Date: Mon, 26 Jun 2006 18:20:56 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 100078 for review Message-ID: <200606261820.k5QIKuJ5004651@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606261820.k5QIKuJ5004651>