map.h 744 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#ifndef INCLUDE_map_h__
#define INCLUDE_map_h__

#include "common.h"


/* git__mmap() prot values */
#define GIT_PROT_NONE  0x0
#define GIT_PROT_READ  0x1
#define GIT_PROT_WRITE 0x2
#define GIT_PROT_EXEC  0x4

/* git__mmmap() flags values */
#define GIT_MAP_FILE    0
#define GIT_MAP_SHARED  1
#define GIT_MAP_PRIVATE 2
#define GIT_MAP_TYPE    0xf
#define GIT_MAP_FIXED   0x10

typedef struct {  /* memory mapped buffer   */
	void *data;  /* data bytes          */
	size_t len;  /* data length         */
#ifdef GIT_WIN32
	HANDLE fmh;  /* file mapping handle */
#endif
} git_map;

28
extern int git__mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset);
29
extern int git__munmap(git_map *map);
30 31

#endif /* INCLUDE_map_h__ */