struct nine_memfd_file *memfd_file,
struct nine_memfd_file_region *region)
{
- int error;
DBG("Unmapping memfd mapped region at %d: size: %d, map=%p, locks=%d, weak=%d\n",
region->offset, region->size, region->map,
region->num_locks, region->num_weak_unlocks);
assert(region->map != NULL);
- if (munmap(region->map, region->size) != 0) {
- error = errno;
- fprintf(stderr, "Error on unmapping, errno=%d\n", error);
- }
+ if (munmap(region->map, region->size) != 0)
+ fprintf(stderr, "Error on unmapping, errno=%d\n", (int)errno);
region->map = NULL;
/* Move from one of the mapped region list to the unmapped one */
static bool
nine_memfd_region_map(struct nine_allocator *allocator, struct nine_memfd_file *memfd_file, struct nine_memfd_file_region *region)
{
- int error;
if (region->map != NULL)
return true;
buf = mmap(NULL, region->size, PROT_READ | PROT_WRITE, MAP_SHARED, memfd_file->fd, region->offset);
}
if (buf == MAP_FAILED) {
- error = errno;
- DBG("Failed to mmap a memfd file, errno=%d\n", error);
+ DBG("Failed to mmap a memfd file, errno=%d\n", (int)errno);
return false;
}
region->map = buf;
{
struct nine_memfd_file *memfd_file;
struct nine_memfd_file_region *region;
- int error;
-
allocation_size = DIVUP(allocation_size, allocator->page_size) * allocator->page_size;
new_allocation->allocation_type = NINE_MEMFD_ALLOC;
memfd_file->fd = memfd_create("gallium_nine_ram", 0);
if (memfd_file->fd == -1) {
- error = errno;
- DBG("Failed to created a memfd file, errno=%d\n", error);
+ DBG("Failed to created a memfd file, errno=%d\n", (int)errno);
allocator->num_fd--;
return false;
}
if (ftruncate(memfd_file->fd, memfd_file->filesize) != 0) {
- error = errno;
- DBG("Failed to resize a memfd file, errno=%d\n", error);
+ DBG("Failed to resize a memfd file, errno=%d\n", (int)errno);
close(memfd_file->fd);
allocator->num_fd--;
return false;