23 : address_(nullptr), size_(0) {
24 fuchsia::mem::Buffer buffer;
30 uint32_t flags = ZX_VM_PERM_READ;
32 flags |= ZX_VM_PERM_EXECUTE;
36 const zx_status_t status =
37 zx::vmar::root_self()->map(flags, 0, buffer.vmo, 0, buffer.size, &addr);
38 if (status != ZX_OK) {
39 FML_LOG(FATAL) <<
"Failed to map " << path <<
": "
40 << zx_status_get_string(status);
43 address_ =
reinterpret_cast<void*
>(addr);
77 fuchsia::io::Flags flags = fuchsia::io::PERM_READABLE;
79 flags |= fuchsia::io::PERM_EXECUTABLE;
85 const zx_status_t status = fdio_open3_fd(path, uint64_t{flags}, &fd);
86 if (status != ZX_OK) {
92 std::initializer_list<Protection> protection_execute = {Protection::kRead,
93 Protection::kExecute};
94 std::initializer_list<Protection> protection_read = {Protection::kRead};
95 auto mapping = std::make_unique<fml::FileMapping>(
96 fml::UniqueFD{fd}, executable ? protection_execute : protection_read);
98 if (!mapping->IsValid()) {