Prefer MADV_* over POSIX_MADV_* in kernel for consistency: the latter
authorguenther <guenther@openbsd.org>
Wed, 17 Dec 2014 06:58:10 +0000 (06:58 +0000)
committerguenther <guenther@openbsd.org>
Wed, 17 Dec 2014 06:58:10 +0000 (06:58 +0000)
doesn't have all the values and therefore can't be used everywhere.

ok deraadt@ kettenis@

19 files changed:
sys/arch/sparc/sparc/pmap.c
sys/arch/sparc64/sparc64/pmap.c
sys/arch/vax/vax/pmap.c
sys/dev/isa/aha.c
sys/dev/pci/drm/i915/i915_gem.c
sys/dev/pci/drm/i915/intel_ringbuffer.c
sys/kern/exec_subr.c
sys/kern/init_main.c
sys/kern/kern_exec.c
sys/kern/sysv_shm.c
sys/kern/vfs_biomem.c
sys/sys/mman.h
sys/tmpfs/tmpfs_subr.c
sys/uvm/uvm_fault.c
sys/uvm/uvm_init.c
sys/uvm/uvm_km.c
sys/uvm/uvm_mmap.c
sys/uvm/uvm_object.c
sys/uvm/uvm_unix.c

index 6415d37..bf7d480 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: pmap.c,v 1.171 2014/12/17 06:05:52 deraadt Exp $      */
+/*     $OpenBSD: pmap.c,v 1.172 2014/12/17 06:58:10 guenther Exp $     */
 /*     $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */
 
 /*
@@ -6257,7 +6257,7 @@ pmap_remove_holes(struct vm_map *map)
                (void)uvm_map(map, &shole, ehole - shole, NULL,
                    UVM_UNKNOWN_OFFSET, 0,
                    UVM_MAPFLAG(PROT_NONE, PROT_NONE, MAP_INHERIT_SHARE,
-                     POSIX_MADV_RANDOM,
+                     MADV_RANDOM,
                      UVM_FLAG_NOMERGE | UVM_FLAG_HOLE | UVM_FLAG_FIXED));
        }
 #endif
index 49bfbc0..5df58a8 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: pmap.c,v 1.84 2014/12/15 02:24:23 guenther Exp $      */
+/*     $OpenBSD: pmap.c,v 1.85 2014/12/17 06:58:10 guenther Exp $      */
 /*     $NetBSD: pmap.c,v 1.107 2001/08/31 16:47:41 eeh Exp $   */
 #undef NO_VCACHE /* Don't forget the locked TLB in dostart */
 /*
@@ -3639,8 +3639,7 @@ pmap_remove_holes(struct vm_map *map)
                return;
 
        (void)uvm_map(map, &shole, ehole - shole, NULL, UVM_UNKNOWN_OFFSET, 0,
-           UVM_MAPFLAG(PROT_NONE, PROT_NONE, MAP_INHERIT_SHARE,
-             POSIX_MADV_RANDOM,
+           UVM_MAPFLAG(PROT_NONE, PROT_NONE, MAP_INHERIT_SHARE, MADV_RANDOM,
              UVM_FLAG_NOMERGE | UVM_FLAG_HOLE | UVM_FLAG_FIXED));
 }
 
index f8643dd..6a51efe 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: pmap.c,v 1.73 2014/12/15 02:24:23 guenther Exp $ */
+/*     $OpenBSD: pmap.c,v 1.74 2014/12/17 06:58:10 guenther Exp $ */
 /*     $NetBSD: pmap.c,v 1.74 1999/11/13 21:32:25 matt Exp $      */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
@@ -868,8 +868,7 @@ pmap_remove_holes(struct vm_map *map)
                return;
 
        (void)uvm_map(map, &shole, ehole - shole, NULL, UVM_UNKNOWN_OFFSET, 0,
-           UVM_MAPFLAG(PROT_NONE, PROT_NONE, MAP_INHERIT_SHARE,
-             POSIX_MADV_RANDOM,
+           UVM_MAPFLAG(PROT_NONE, PROT_NONE, MAP_INHERIT_SHARE, MADV_RANDOM,
              UVM_FLAG_NOMERGE | UVM_FLAG_HOLE | UVM_FLAG_FIXED));
 }
 
index 02a8e85..7e09e43 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: aha.c,v 1.79 2014/12/15 02:24:23 guenther Exp $       */
+/*     $OpenBSD: aha.c,v 1.80 2014/12/17 06:58:10 guenther Exp $       */
 /*     $NetBSD: aha.c,v 1.11 1996/05/12 23:51:23 mycroft Exp $ */
 
 #undef AHADIAG
@@ -1080,7 +1080,7 @@ aha_init(sc)
        if (uvm_pglistalloc(size, 0, 0xffffff, PAGE_SIZE, 0, &pglist, 1,
            UVM_PLA_NOWAIT) || uvm_map(kernel_map, &va, size, NULL,
            UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_MASK, PROT_MASK,
-           MAP_INHERIT_NONE, POSIX_MADV_RANDOM, 0)))
+           MAP_INHERIT_NONE, MADV_RANDOM, 0)))
                panic("aha_init: could not allocate mailbox");
 
        wmbx = (struct aha_mbx *)va;
index 29c2f31..f3c5220 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: i915_gem.c,v 1.77 2014/12/15 02:24:23 guenther Exp $  */
+/*     $OpenBSD: i915_gem.c,v 1.78 2014/12/17 06:58:10 guenther Exp $  */
 /*
  * Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org>
  *
@@ -1451,7 +1451,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
        addr = 0;
        ret = -uvm_map(&curproc->p_vmspace->vm_map, &addr, size,
            obj->uao, args->offset, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE,
-           PROT_READ | PROT_WRITE, MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, 0));
+           PROT_READ | PROT_WRITE, MAP_INHERIT_SHARE, MADV_RANDOM, 0));
        if (ret == 0)
                uao_reference(obj->uao);
        drm_gem_object_unreference_unlocked(obj);
index 614cf25..471286f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: intel_ringbuffer.c,v 1.22 2014/12/15 02:24:23 guenther Exp $  */
+/*     $OpenBSD: intel_ringbuffer.c,v 1.23 2014/12/17 06:58:10 guenther Exp $  */
 /*
  * Copyright © 2008-2010 Intel Corporation
  *
@@ -476,7 +476,7 @@ init_pipe_control(struct intel_ring_buffer *ring)
        obj->base.uao->pgops->pgo_reference(obj->base.uao);
        ret = uvm_map(kernel_map, (vaddr_t *)&pc->cpu_page,
            PAGE_SIZE, obj->base.uao, 0, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE,
-           PROT_READ | PROT_WRITE, MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, 0));
+           PROT_READ | PROT_WRITE, MAP_INHERIT_SHARE, MADV_RANDOM, 0));
        if (ret != 0) {
                DRM_ERROR("Failed to map status page.\n");
                obj->base.uao->pgops->pgo_detach(obj->base.uao);
@@ -1123,7 +1123,7 @@ static int init_status_page(struct intel_ring_buffer *ring)
        obj->base.uao->pgops->pgo_reference(obj->base.uao);
        ret = uvm_map(kernel_map, (vaddr_t *)&ring->status_page.page_addr,
            PAGE_SIZE, obj->base.uao, 0, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE,
-           PROT_READ | PROT_WRITE, MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, 0));
+           PROT_READ | PROT_WRITE, MAP_INHERIT_SHARE, MADV_RANDOM, 0));
        if (ret != 0) {
                obj->base.uao->pgops->pgo_detach(obj->base.uao);
                ret = -ENOMEM;
index 404a127..538e20e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: exec_subr.c,v 1.45 2014/12/16 18:30:03 tedu Exp $     */
+/*     $OpenBSD: exec_subr.c,v 1.46 2014/12/17 06:58:11 guenther Exp $ */
 /*     $NetBSD: exec_subr.c,v 1.9 1994/12/04 03:10:42 mycroft Exp $    */
 
 /*
@@ -197,7 +197,7 @@ vmcmd_map_pagedvn(struct proc *p, struct exec_vmcmd *cmd)
        error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr, cmd->ev_len,
            uobj, cmd->ev_offset, 0,
            UVM_MAPFLAG(cmd->ev_prot, PROT_MASK, MAP_INHERIT_COPY,
-           POSIX_MADV_NORMAL, UVM_FLAG_COPYONW|UVM_FLAG_FIXED));
+           MADV_NORMAL, UVM_FLAG_COPYONW|UVM_FLAG_FIXED));
 
        /*
         * check for error
@@ -235,8 +235,7 @@ vmcmd_map_readvn(struct proc *p, struct exec_vmcmd *cmd)
        error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr,
            round_page(cmd->ev_len), NULL, UVM_UNKNOWN_OFFSET, 0,
            UVM_MAPFLAG(prot | PROT_WRITE, PROT_MASK, MAP_INHERIT_COPY,
-           POSIX_MADV_NORMAL,
-           UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW));
+           MADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW));
 
        if (error)
                return (error);
@@ -277,7 +276,7 @@ vmcmd_map_zero(struct proc *p, struct exec_vmcmd *cmd)
        return (uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr,
            round_page(cmd->ev_len), NULL, UVM_UNKNOWN_OFFSET, 0,
            UVM_MAPFLAG(cmd->ev_prot, PROT_MASK, MAP_INHERIT_COPY,
-           POSIX_MADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_COPYONW)));
+           MADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_COPYONW)));
 }
 
 /*
index b197c0a..4191d38 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: init_main.c,v 1.228 2014/12/16 18:30:03 tedu Exp $    */
+/*     $OpenBSD: init_main.c,v 1.229 2014/12/17 06:58:11 guenther Exp $        */
 /*     $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $   */
 
 /*
@@ -638,7 +638,7 @@ start_init(void *arg)
        if (uvm_map(&p->p_vmspace->vm_map, &addr, PAGE_SIZE, 
            NULL, UVM_UNKNOWN_OFFSET, 0,
            UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_MASK, MAP_INHERIT_COPY,
-           POSIX_MADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)))
+           MADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)))
                panic("init: couldn't allocate argument space");
        p->p_vmspace->vm_maxsaddr = (caddr_t)addr;
 
index 496e539..cad14a4 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: kern_exec.c,v 1.152 2014/12/16 18:30:04 tedu Exp $    */
+/*     $OpenBSD: kern_exec.c,v 1.153 2014/12/17 06:58:11 guenther Exp $        */
 /*     $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $  */
 
 /*-
@@ -836,7 +836,7 @@ exec_sigcode_map(struct process *pr, struct emul *e)
 
                if ((r = uvm_map(kernel_map, &va, round_page(sz), e->e_sigobject,
                    0, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
-                   MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, 0)))) {
+                   MAP_INHERIT_SHARE, MADV_RANDOM, 0)))) {
                        uao_detach(e->e_sigobject);
                        return (ENOMEM);
                }
@@ -848,7 +848,7 @@ exec_sigcode_map(struct process *pr, struct emul *e)
        uao_reference(e->e_sigobject);
        if (uvm_map(&pr->ps_vmspace->vm_map, &pr->ps_sigcode, round_page(sz),
            e->e_sigobject, 0, 0, UVM_MAPFLAG(PROT_READ | PROT_EXEC,
-           PROT_READ | PROT_EXEC, MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, 0))) {
+           PROT_READ | PROT_EXEC, MAP_INHERIT_SHARE, MADV_RANDOM, 0))) {
                uao_detach(e->e_sigobject);
                return (ENOMEM);
        }
index b6dfaa7..2b323c7 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: sysv_shm.c,v 1.62 2014/12/15 02:24:23 guenther Exp $  */
+/*     $OpenBSD: sysv_shm.c,v 1.63 2014/12/17 06:58:11 guenther Exp $  */
 /*     $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $       */
 
 /*
@@ -267,7 +267,7 @@ sys_shmat(struct proc *p, void *v, register_t *retval)
        uao_reference(shm_handle->shm_object);
        error = uvm_map(&p->p_vmspace->vm_map, &attach_va, size,
            shm_handle->shm_object, 0, 0, UVM_MAPFLAG(prot, prot,
-           MAP_INHERIT_SHARE, POSIX_MADV_RANDOM, 0));
+           MAP_INHERIT_SHARE, MADV_RANDOM, 0));
        if (error) {
                uao_detach(shm_handle->shm_object);
                return (error);
index d1dfacf..a2efed3 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: vfs_biomem.c,v 1.32 2014/12/15 02:24:23 guenther Exp $ */
+/*     $OpenBSD: vfs_biomem.c,v 1.33 2014/12/17 06:58:11 guenther Exp $ */
 
 /*
  * Copyright (c) 2007 Artur Grabowski <art@openbsd.org>
@@ -54,7 +54,7 @@ buf_mem_init(vsize_t size)
        buf_kva_start = vm_map_min(kernel_map);
        if (uvm_map(kernel_map, &buf_kva_start, size, NULL,
            UVM_UNKNOWN_OFFSET, PAGE_SIZE, UVM_MAPFLAG(PROT_NONE,
-           PROT_NONE, MAP_INHERIT_NONE, POSIX_MADV_NORMAL, 0)))
+           PROT_NONE, MAP_INHERIT_NONE, MADV_NORMAL, 0)))
                panic("bufinit: can't reserve VM for buffers");
        buf_kva_end = buf_kva_start + size;
 
index 461e1e9..d3a937d 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: mman.h,v 1.27 2014/10/03 17:41:00 kettenis Exp $      */
+/*     $OpenBSD: mman.h,v 1.28 2014/12/17 06:58:10 guenther Exp $      */
 /*     $NetBSD: mman.h,v 1.11 1995/03/26 20:24:23 jtc Exp $    */
 
 /*-
 #if __BSD_VISIBLE
 /*
  * Original advice values, equivalent to POSIX definitions,
- * and few implementation-specific ones.
+ * and few implementation-specific ones.  For in-kernel and historic use.
  */
 #define        MADV_NORMAL             POSIX_MADV_NORMAL
 #define        MADV_RANDOM             POSIX_MADV_RANDOM
index bb42fff..c3c13ab 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: tmpfs_subr.c,v 1.10 2014/12/15 02:24:23 guenther Exp $        */
+/*     $OpenBSD: tmpfs_subr.c,v 1.11 2014/12/17 06:58:11 guenther Exp $        */
 /*     $NetBSD: tmpfs_subr.c,v 1.79 2012/03/13 18:40:50 elad Exp $     */
 
 /*
@@ -1230,10 +1230,10 @@ tmpfs_uiomove(tmpfs_node_t *node, struct uio *uio, vsize_t len)
 
        if (len >= TMPFS_UIO_MAXBYTES) {
                sz = TMPFS_UIO_MAXBYTES;
-               adv = POSIX_MADV_NORMAL;
+               adv = MADV_NORMAL;
        } else {
                sz = len;
-               adv = POSIX_MADV_SEQUENTIAL;
+               adv = MADV_SEQUENTIAL;
        }
 
        if (tmpfs_uio_cached(node))
@@ -1270,7 +1270,7 @@ tmpfs_zeropg(tmpfs_node_t *node, voff_t pgnum, vaddr_t pgoff)
 
        error = uvm_map(kernel_map, &va, PAGE_SIZE, node->tn_uobj, pgnum, 0,
            UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
-           MAP_INHERIT_NONE, POSIX_MADV_NORMAL, 0));
+           MAP_INHERIT_NONE, MADV_NORMAL, 0));
        if (error) {
                uao_detach(node->tn_uobj); /* Drop reference. */
                return error;
index fb61793..ffc5949 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_fault.c,v 1.80 2014/12/15 02:24:23 guenther Exp $ */
+/*     $OpenBSD: uvm_fault.c,v 1.81 2014/12/17 06:58:11 guenther Exp $ */
 /*     $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $   */
 
 /*
@@ -206,15 +206,15 @@ uvmfault_init()
        npages = atop(16384);
        if (npages > 0) {
                KASSERT(npages <= UVM_MAXRANGE / 2);
-               uvmadvice[POSIX_MADV_NORMAL].nforw = npages;
-               uvmadvice[POSIX_MADV_NORMAL].nback = npages - 1;
+               uvmadvice[MADV_NORMAL].nforw = npages;
+               uvmadvice[MADV_NORMAL].nback = npages - 1;
        }
 
        npages = atop(32768);
        if (npages > 0) {
                KASSERT(npages <= UVM_MAXRANGE / 2);
-               uvmadvice[POSIX_MADV_SEQUENTIAL].nforw = npages - 1;
-               uvmadvice[POSIX_MADV_SEQUENTIAL].nback = npages;
+               uvmadvice[MADV_SEQUENTIAL].nforw = npages - 1;
+               uvmadvice[MADV_SEQUENTIAL].nback = npages;
        }
 }
 
index 6efe210..f3628aa 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_init.c,v 1.36 2014/12/15 02:24:23 guenther Exp $  */
+/*     $OpenBSD: uvm_init.c,v 1.37 2014/12/17 06:58:11 guenther Exp $  */
 /*     $NetBSD: uvm_init.c,v 1.14 2000/06/27 17:29:23 mrg Exp $        */
 
 /*
@@ -148,14 +148,14 @@ uvm_init(void)
        kvm_start = trunc_page(DEADBEEF0) - PAGE_SIZE;
        if (uvm_map(kernel_map, &kvm_start, 3 * PAGE_SIZE,
            NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_NONE,
-           PROT_NONE, MAP_INHERIT_NONE, POSIX_MADV_RANDOM, UVM_FLAG_FIXED)))
+           PROT_NONE, MAP_INHERIT_NONE, MADV_RANDOM, UVM_FLAG_FIXED)))
                panic("uvm_init: cannot reserve dead beef @0x%x", DEADBEEF0);
 #endif
 #ifdef DEADBEEF1
        kvm_start = trunc_page(DEADBEEF1) - PAGE_SIZE;
        if (uvm_map(kernel_map, &kvm_start, 3 * PAGE_SIZE,
            NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_NONE,
-           PROT_NONE, MAP_INHERIT_NONE, POSIX_MADV_RANDOM, UVM_FLAG_FIXED)))
+           PROT_NONE, MAP_INHERIT_NONE, MADV_RANDOM, UVM_FLAG_FIXED)))
                panic("uvm_init: cannot reserve dead beef @0x%x", DEADBEEF1);
 #endif
        /*
index 53ddeef..6266c8d 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_km.c,v 1.122 2014/12/15 02:24:23 guenther Exp $   */
+/*     $OpenBSD: uvm_km.c,v 1.123 2014/12/17 06:58:11 guenther Exp $   */
 /*     $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $      */
 
 /* 
@@ -184,7 +184,7 @@ uvm_km_init(vaddr_t start, vaddr_t end)
        if (base != start && uvm_map(&kernel_map_store, &base, start - base,
            NULL, UVM_UNKNOWN_OFFSET, 0,
            UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
-           MAP_INHERIT_NONE, POSIX_MADV_RANDOM, UVM_FLAG_FIXED)) != 0)
+           MAP_INHERIT_NONE, MADV_RANDOM, UVM_FLAG_FIXED)) != 0)
                panic("uvm_km_init: could not reserve space for kernel");
        
        kernel_map = &kernel_map_store;
@@ -210,9 +210,8 @@ uvm_km_suballoc(struct vm_map *map, vaddr_t *min, vaddr_t *max, vsize_t size,
 
        /* first allocate a blank spot in the parent map */
        if (uvm_map(map, min, size, NULL, UVM_UNKNOWN_OFFSET, 0,
-           UVM_MAPFLAG(PROT_READ | PROT_WRITE,
-           PROT_READ | PROT_WRITE, MAP_INHERIT_NONE,
-           POSIX_MADV_RANDOM, mapflags)) != 0) {
+           UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
+           MAP_INHERIT_NONE, MADV_RANDOM, mapflags)) != 0) {
               panic("uvm_km_suballoc: unable to allocate space in parent map");
        }
 
@@ -340,9 +339,8 @@ uvm_km_kmemalloc_pla(struct vm_map *map, struct uvm_object *obj, vsize_t size,
 
        /* allocate some virtual space */
        if (__predict_false(uvm_map(map, &kva, size, obj, UVM_UNKNOWN_OFFSET,
-           valign, UVM_MAPFLAG(PROT_READ | PROT_WRITE,
-           PROT_READ | PROT_WRITE, MAP_INHERIT_NONE,
-           POSIX_MADV_RANDOM, (flags & UVM_KMF_TRYLOCK))) != 0)) {
+           valign, UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
+           MAP_INHERIT_NONE, MADV_RANDOM, (flags & UVM_KMF_TRYLOCK))) != 0)) {
                return(0);
        }
 
@@ -460,7 +458,7 @@ uvm_km_alloc1(struct vm_map *map, vsize_t size, vsize_t align, boolean_t zeroit)
            UVM_UNKNOWN_OFFSET, align,
            UVM_MAPFLAG(PROT_READ | PROT_WRITE,
            PROT_READ | PROT_WRITE | PROT_EXEC,
-           MAP_INHERIT_NONE, POSIX_MADV_RANDOM, 0)) != 0)) {
+           MAP_INHERIT_NONE, MADV_RANDOM, 0)) != 0)) {
                return(0);
        }
 
@@ -548,7 +546,7 @@ uvm_km_valloc_align(struct vm_map *map, vsize_t size, vsize_t align, int flags)
        if (__predict_false(uvm_map(map, &kva, size, uvm.kernel_object,
            UVM_UNKNOWN_OFFSET, align,
            UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
-           MAP_INHERIT_NONE, POSIX_MADV_RANDOM, flags)) != 0)) {
+           MAP_INHERIT_NONE, MADV_RANDOM, flags)) != 0)) {
                return(0);
        }
 
@@ -583,7 +581,7 @@ uvm_km_valloc_prefer_wait(struct vm_map *map, vsize_t size, voff_t prefer)
                if (__predict_true(uvm_map(map, &kva, size, uvm.kernel_object,
                    prefer, 0,
                    UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
-                   MAP_INHERIT_NONE, POSIX_MADV_RANDOM, 0)) == 0)) {
+                   MAP_INHERIT_NONE, MADV_RANDOM, 0)) == 0)) {
                        return(kva);
                }
 
@@ -668,7 +666,7 @@ uvm_km_page_init(void)
                    NULL, UVM_UNKNOWN_OFFSET, 0,
                    UVM_MAPFLAG(PROT_READ | PROT_WRITE,
                    PROT_READ | PROT_WRITE, MAP_INHERIT_NONE,
-                   POSIX_MADV_RANDOM, UVM_KMF_TRYLOCK)) != 0) {
+                   MADV_RANDOM, UVM_KMF_TRYLOCK)) != 0) {
                        bulk /= 2;
                        continue;
                }
@@ -731,9 +729,8 @@ uvm_km_thread(void *arg)
                         * if fp != NULL
                         */
                        flags = UVM_MAPFLAG(PROT_READ | PROT_WRITE,
-                           PROT_READ | PROT_WRITE,
-                           MAP_INHERIT_NONE, POSIX_MADV_RANDOM,
-                           fp != NULL ? UVM_KMF_TRYLOCK : 0);
+                           PROT_READ | PROT_WRITE, MAP_INHERIT_NONE,
+                           MADV_RANDOM, fp != NULL ? UVM_KMF_TRYLOCK : 0);
                        memset(pg, 0, sizeof(pg));
                        for (i = 0; i < nitems(pg); i++) {
                                pg[i] = vm_map_min(kernel_map);
@@ -745,9 +742,8 @@ uvm_km_thread(void *arg)
 
                                /* made progress, so don't sleep for more */
                                flags = UVM_MAPFLAG(PROT_READ | PROT_WRITE,
-                                   PROT_READ | PROT_WRITE,
-                                   MAP_INHERIT_NONE, POSIX_MADV_RANDOM,
-                                   UVM_KMF_TRYLOCK);
+                                   PROT_READ | PROT_WRITE, MAP_INHERIT_NONE,
+                                   MADV_RANDOM, UVM_KMF_TRYLOCK);
                        }
 
                        mtx_enter(&uvm_km_pages.mtx);
@@ -921,7 +917,7 @@ try_map:
                va = vm_map_min(map);
                if (uvm_map(map, &va, sz, uobj, kd->kd_prefer,
                    kv->kv_align, UVM_MAPFLAG(prot, prot, MAP_INHERIT_NONE,
-                   POSIX_MADV_RANDOM, mapflags))) {
+                   MADV_RANDOM, mapflags))) {
                        if (kv->kv_wait && kd->kd_waitok) {
                                tsleep(map, PVM, "km_allocva", 0);
                                goto try_map;
index 3912d34..7fa7bfe 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_mmap.c,v 1.103 2014/12/16 18:30:04 tedu Exp $     */
+/*     $OpenBSD: uvm_mmap.c,v 1.104 2014/12/17 06:58:11 guenther Exp $ */
 /*     $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $        */
 
 /*
@@ -903,7 +903,7 @@ uvm_mmap(vm_map_t map, vaddr_t *addr, vsize_t size, vm_prot_t prot,
        struct uvm_object *uobj;
        struct vnode *vp;
        int error;
-       int advice = POSIX_MADV_NORMAL;
+       int advice = MADV_NORMAL;
        uvm_flag_t uvmflag = 0;
        vsize_t align = 0;      /* userland page size */
 
@@ -995,7 +995,7 @@ uvm_mmap(vm_map_t map, vaddr_t *addr, vsize_t size, vm_prot_t prot,
                                    (flags & MAP_SHARED) ? maxprot :
                                    (maxprot & ~PROT_WRITE), foff, size);
                        }
-                       advice = POSIX_MADV_RANDOM;
+                       advice = MADV_RANDOM;
                }
                
                if (uobj == NULL)
index 0e82469..519a8e5 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_object.c,v 1.10 2014/11/16 12:31:00 deraadt Exp $ */
+/*     $OpenBSD: uvm_object.c,v 1.11 2014/12/17 06:58:11 guenther Exp $        */
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@ uvm_objwire(struct uvm_object *uobj, voff_t start, voff_t end,
                /* Get the pages */
                memset(pgs, 0, sizeof(pgs));
                error = (*uobj->pgops->pgo_get)(uobj, offset, pgs, &npages, 0,
-                       PROT_READ | PROT_WRITE, POSIX_MADV_SEQUENTIAL,
+                       PROT_READ | PROT_WRITE, MADV_SEQUENTIAL,
                        PGO_ALLPAGES | PGO_SYNCIO);
 
                if (error)
index 4e28942..3bc74bc 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_unix.c,v 1.53 2014/12/15 02:24:23 guenther Exp $  */
+/*     $OpenBSD: uvm_unix.c,v 1.54 2014/12/17 06:58:11 guenther Exp $  */
 /*     $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $    */
 
 /*
@@ -87,7 +87,7 @@ sys_obreak(struct proc *p, void *v, register_t *retval)
                    UVM_UNKNOWN_OFFSET, 0,
                    UVM_MAPFLAG(PROT_READ | PROT_WRITE,
                    PROT_READ | PROT_WRITE | PROT_EXEC, MAP_INHERIT_COPY,
-                   POSIX_MADV_NORMAL, UVM_FLAG_AMAPPAD|UVM_FLAG_FIXED|
+                   MADV_NORMAL, UVM_FLAG_AMAPPAD|UVM_FLAG_FIXED|
                    UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW));
                if (error) {
                        uprintf("sbrk: grow %ld failed, error = %d\n",