1 /* map.h -- memory mapping functions 2 * 3 * Copyright (c) 1994-2008 Carnegie Mellon University. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in 14 * the documentation and/or other materials provided with the 15 * distribution. 16 * 17 * 3. The name "Carnegie Mellon University" must not be used to 18 * endorse or promote products derived from this software without 19 * prior written permission. For permission or any legal 20 * details, please contact 21 * Carnegie Mellon University 22 * Center for Technology Transfer and Enterprise Creation 23 * 4615 Forbes Avenue 24 * Suite 302 25 * Pittsburgh, PA 15213 26 * (412) 268-7393, fax: (412) 268-7395 27 * innovation@andrew.cmu.edu 28 * 29 * 4. Redistributions of any form whatsoever must retain the following 30 * acknowledgment: 31 * "This product includes software developed by Computing Services 32 * at Carnegie Mellon University (http://www.cmu.edu/computing/)." 33 * 34 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO 35 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 36 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE 37 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 38 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 39 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 40 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 41 */ 42 43 #ifndef INCLUDED_MAP_H 44 #define INCLUDED_MAP_H 45 46 #define MAP_UNKNOWN_LEN ((unsigned long)-1) 47 48 extern const char map_method_desc[]; 49 50 /* Create a memory map 51 * 52 * fd is the file descriptor which is to be mapped 53 * onceonly is set to be nonzero if you do not intend to ever refresh the map 54 * base and len are output parameters that receive the address and length 55 * of the map once it is created. NOTE: *len should be zero the first 56 * time map_refresh() is called to force the initial mapping 57 * newlen is set to the size of the file, or MAP_UNKNOWN_LEN to have the 58 * mapping facility compute it for you. 59 * name and mboxname are used for logging purposes, name is the name 60 * of the file, and shouldn't be NULL, while mboxname is the name 61 * of the applicable mailbox (if any), and may be NULL 62 */ 63 extern void map_refresh(int fd, int onceonly, const char **base, 64 size_t *len, size_t newlen, 65 const char *name, const char *mboxname); 66 67 /* map_free will free a memory map allocated by map_refresh 68 * 69 * base and len are the same values that were passed to map_refresh */ 70 extern void map_free(const char **base, size_t *len); 71 72 #endif /* INCLUDED_MAP_H */ 73