Lines Matching defs:filemap
23 * @2 Pointer to filemap structure
27 int map_file(const char *filename, struct filemap_t *filemap) {
30 filemap->fd = open(filename, O_RDONLY);
31 if (filemap->fd == -1) {
35 if (fstat(filemap->fd, &statbuf)) {
36 close(filemap->fd);
40 filemap->size = statbuf.st_size;
42 filemap->map = mmap(0, filemap->size, PROT_READ, MAP_SHARED, filemap->fd, 0);
43 if (filemap->map == MAP_FAILED) {
44 close(filemap->fd);
54 * @1 Pointer to filemap structure
58 int unmap_file(struct filemap_t *filemap) {
59 munmap(filemap->map, filemap->size);
60 close(filemap->fd);