13 {
14 int fd = open(
path.data(), O_RDONLY);
15 if (fd < 0) {
16 return absl::UnavailableError("can't open file");
17 }
18
19 struct stat st;
20 if (fstat(fd, &st) < 0) {
21 close(fd);
22 return absl::UnavailableError("can't stat file");
23 }
24
25 if (st.st_size <= 0) {
26 close(fd);
27 return absl::InvalidArgumentError("file of zero length");
28 }
29
30 const char*
data =
static_cast<const char*
>(
31 mmap(nullptr, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0));
32
33 if (
data == MAP_FAILED) {
34 close(fd);
35 return absl::UnavailableError(
36 absl::StrCat("can't mmap file (", path, "): ", std::strerror(errno)));
37 }
38
40}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
std::shared_ptr< const fml::Mapping > data