2010-06-03 22:46:59 +00:00
|
|
|
/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */
|
2001-05-12 03:34:27 +00:00
|
|
|
#ifndef MMAP_H
|
|
|
|
#define MMAP_H
|
|
|
|
|
2006-11-07 17:56:05 +00:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2012-02-07 17:02:40 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2001-05-12 03:34:27 +00:00
|
|
|
/* open file for reading, mmap whole file, close file, write length of
|
|
|
|
* map in filesize and return pointer to map. */
|
2014-04-02 13:59:03 +00:00
|
|
|
const char* mmap_read(const char *filename,size_t* filesize);
|
2001-05-12 03:34:27 +00:00
|
|
|
|
2016-07-14 16:19:47 +00:00
|
|
|
/* like mmap_read but use openat instead of open */
|
|
|
|
const char* mmap_readat(const char *filename,size_t* filesize,int dirfd);
|
|
|
|
|
2001-05-12 03:34:27 +00:00
|
|
|
/* open file for writing, mmap whole file privately (copy on write),
|
|
|
|
* close file, write length of map in filesize and return pointer to
|
|
|
|
* map. */
|
2006-11-07 17:56:05 +00:00
|
|
|
char* mmap_private(const char *filename,size_t* filesize);
|
2001-05-12 03:34:27 +00:00
|
|
|
|
|
|
|
/* open file for writing, mmap whole file shared, close file, write
|
|
|
|
* length of map in filesize and return pointer to map. */
|
2006-11-07 17:56:05 +00:00
|
|
|
char* mmap_shared(const char *filename,size_t* filesize);
|
2001-05-12 03:34:27 +00:00
|
|
|
|
2006-05-18 06:02:43 +00:00
|
|
|
/* unmap a mapped region */
|
2013-08-22 23:42:46 +00:00
|
|
|
int mmap_unmap(const char* mapped,size_t maplen);
|
2006-05-18 06:02:43 +00:00
|
|
|
|
2012-02-07 17:02:40 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-05-12 03:34:27 +00:00
|
|
|
#endif
|