memguard.h revision 285830
164562Sgshapiro/*- 266494Sgshapiro * Copyright (c) 2005, 364562Sgshapiro * Bosko Milekic <bmilekic@FreeBSD.org>. All rights reserved. 464562Sgshapiro * 564562Sgshapiro * Redistribution and use in source and binary forms, with or without 664562Sgshapiro * modification, are permitted provided that the following conditions 764562Sgshapiro * are met: 864562Sgshapiro * 1. Redistributions of source code must retain the above copyright 964562Sgshapiro * notice unmodified, this list of conditions, and the following 1066494Sgshapiro * disclaimer. 1164562Sgshapiro * 2. Redistributions in binary form must reproduce the above copyright 1264562Sgshapiro * notice, this list of conditions and the following disclaimer in the 1364562Sgshapiro * documentation and/or other materials provided with the distribution. 1464562Sgshapiro * 1564562Sgshapiro * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1664562Sgshapiro * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1764562Sgshapiro * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1864562Sgshapiro * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1964562Sgshapiro * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2064562Sgshapiro * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2164562Sgshapiro * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2264562Sgshapiro * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2364562Sgshapiro * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2464562Sgshapiro * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2564562Sgshapiro * 2664562Sgshapiro * $FreeBSD: releng/10.2/sys/vm/memguard.h 254025 2013-08-07 06:21:20Z jeff $ 2764562Sgshapiro */ 2864562Sgshapiro 2964562Sgshapiro#ifndef _VM_MEMGUARD_H_ 3064562Sgshapiro#define _VM_MEMGUARD_H_ 3164562Sgshapiro 3264562Sgshapiro#include "opt_vm.h" 3364562Sgshapiro 3464562Sgshapirostruct malloc_type; 3564562Sgshapirostruct vm_map; 3664562Sgshapirostruct vmem; 3764562Sgshapiro 3864562Sgshapiro#ifdef DEBUG_MEMGUARD 3964562Sgshapirounsigned long memguard_fudge(unsigned long, const struct vm_map *); 4064562Sgshapirovoid memguard_init(struct vmem *); 4164562Sgshapirovoid *memguard_alloc(unsigned long, int); 4264562Sgshapirovoid *memguard_realloc(void *, unsigned long, struct malloc_type *, int); 4364562Sgshapirovoid memguard_free(void *); 4464562Sgshapiroint memguard_cmp_mtp(struct malloc_type *, unsigned long); 4564562Sgshapiroint memguard_cmp_zone(uma_zone_t); 4664562Sgshapiroint is_memguard_addr(void *); 4764562Sgshapiro#else 4864562Sgshapiro#define memguard_fudge(size, xxx) (size) 4964562Sgshapiro#define memguard_init(map) do { } while (0) 5064562Sgshapiro#define memguard_alloc(size, flags) NULL 5164562Sgshapiro#define memguard_realloc(a, s, mtp, f) NULL 5264562Sgshapiro#define memguard_free(addr) do { } while (0) 5364562Sgshapiro#define memguard_cmp_mtp(mtp, size) 0 5464562Sgshapiro#define memguard_cmp_zone(zone) 0 5564562Sgshapiro#define is_memguard_addr(addr) 0 5664562Sgshapiro#endif 5764562Sgshapiro 5864562Sgshapiro#endif /* _VM_MEMGUARD_H_ */ 5964562Sgshapiro