- if (map->addr == NULL) {
- int fd = openat(log->dirfd, map->filename, O_RDONLY);
-
- if (fd < 0) {
- fprintf(stderr, "Error opening logfile %s: %m\n", map->filename);
- goto exit2;
- }
-
- off_t length = lseek(fd, 0, SEEK_END);
- map->addr = (const char *)mmap(NULL, length, PROT_READ, MAP_SHARED,
- fd, 0);
- g_atomic_int_add(&log->disk_used, -(map->len / 1024));
- map->len = length;
- g_atomic_int_add(&log->disk_used, map->len / 1024);
-
- g_atomic_int_inc(&map->refcount);
-
- close(fd);
- }
-