MMAP_FILE_ACCESS_READ_WRITE_EXECUTE = 5,
};
+#ifndef DEFFILEMODE
+#define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
+#endif
static int mmap_init_state;
static mono_mutex_t named_regions_mutex;
}
}
-#ifndef PLATFORM_ANDROID
if (path) //FIXME use io portability?
fd = open (c_path, file_mode_to_unix (mode) | access_mode_to_unix (access), DEFFILEMODE);
else
fd = dup (input_fd);
-#else
- // FIXME: No DEFFILEMODE
- fd = -1;
- g_assert_not_reached ();
-#endif
if (fd == -1) { //XXX translate errno?
*error = COULD_NOT_OPEN;
*capacity = align_up_to_page_size ((size_t)*capacity);
- if (*capacity > buf.st_size)
- ftruncate (fd, (off_t)*capacity);
+ if (*capacity > buf.st_size) {
+ int unused G_GNUC_UNUSED = ftruncate (fd, (off_t)*capacity);
+ }
handle = g_new0 (FileHandle, 1);
handle->handle.kind = MMAP_KIND_FILE;
if (!eff_size)
eff_size = *size = mh->length;
- mmap_offset = (size_t)mmap_offset;
+ mmap_offset = (size_t)offset;
res.address = (char*)mh->address + offset;
- res.length = (size_t)size;
+ res.length = (size_t)*size;
res.kind = MMAP_KIND_MEMORY;
}