CWB
Macros | Functions
windows-mmap.h File Reference
#include <windows.h>
#include <sys/stat.h>
#include <stdint.h>
#include <stdio.h>
#include <io.h>

Macros

#define PROT_READ   1
 
#define PROT_WRITE   2
 
#define MAP_FAILED   ((void*)-1)
 
#define MAP_SHARED   0x01 /* Share changes. */
 
#define MAP_PRIVATE   0x02 /* Changes are private. */
 

Functions

void * mmap (void *start, size_t length, int prot, int flags, int fd, off_t offset)
 Substitute POSIX mmap() for use in Windows. More...
 
int munmap (void *start, size_t length)
 Substitute POSIX munmap() for environments that lack it. More...
 

Macro Definition Documentation

#define MAP_FAILED   ((void*)-1)
#define MAP_PRIVATE   0x02 /* Changes are private. */

Referenced by mmap().

#define MAP_SHARED   0x01 /* Share changes. */

Referenced by mmapfile().

#define PROT_READ   1

Referenced by mmapfile().

#define PROT_WRITE   2

Referenced by mmapfile().

Function Documentation

void* mmap ( void *  start,
size_t  length,
int  prot,
int  flags,
int  fd,
off_t  offset 
)

Substitute POSIX mmap() for use in Windows.

It wraps the Windows API functions CreateFileMapping() and MapViewOfFileEx().

The arguments, return, etc. are the same as POSIX mmap(), which is documented much more thoroughly than we could hope to do here.

References MAP_FAILED, and MAP_PRIVATE.

Referenced by mmapfile().

int munmap ( void *  start,
size_t  length 
)

Substitute POSIX munmap() for environments that lack it.

It wraps the Windows API function UnmapViewOfFile().

See also
mmap

Referenced by mfree().