Lines Matching defs:filemap
19 int map_file(char *filename, struct filemap_t *filemap) {
22 filemap->fd = open(filename, O_RDONLY);
23 if (filemap->fd == -1) {
27 if (fstat(filemap->fd, &statbuf)) {
28 close(filemap->fd);
32 filemap->size = statbuf.st_size;
34 filemap->map = mmap(0, filemap->size, PROT_READ, MAP_SHARED, filemap->fd, 0);
35 if (filemap->map == MAP_FAILED) {
36 close(filemap->fd);
43 int unmap_file(struct filemap_t *filemap) {
44 close(filemap->fd);
45 munmap(filemap->map, filemap->size);