| 215 | } |
| 216 | |
| 217 | void MultiprocessChild() override { |
| 218 | auto code_address = FromPointerCast<LinuxVMAddress>(getpid); |
| 219 | CheckedWriteFile(WritePipeHandle(), &code_address, sizeof(code_address)); |
| 220 | |
| 221 | auto stack_address = FromPointerCast<LinuxVMAddress>(&code_address); |
| 222 | CheckedWriteFile(WritePipeHandle(), &stack_address, sizeof(stack_address)); |
| 223 | |
| 224 | ScopedMmap mapping; |
| 225 | ASSERT_TRUE(mapping.ResetMmap( |
| 226 | nullptr, page_size_, PROT_NONE, MAP_SHARED | MAP_ANON, -1, 0)); |
| 227 | auto mapped_address = mapping.addr_as<LinuxVMAddress>(); |
| 228 | CheckedWriteFile( |
| 229 | WritePipeHandle(), &mapped_address, sizeof(mapped_address)); |
| 230 | |
| 231 | ScopedTempDir temp_dir; |
| 232 | base::FilePath path = |
| 233 | temp_dir.path().Append(FILE_PATH_LITERAL("test_file")); |
| 234 | ScopedFileHandle handle; |
| 235 | ASSERT_NO_FATAL_FAILURE(InitializeFile(path, page_size_ * 2, &handle)); |
| 236 | |
| 237 | ScopedMmap file_mapping; |
| 238 | ASSERT_TRUE(file_mapping.ResetMmap(nullptr, |
| 239 | page_size_, |
| 240 | PROT_READ | PROT_WRITE, |
| 241 | MAP_PRIVATE, |
| 242 | handle.get(), |
| 243 | page_size_)); |
| 244 | |
| 245 | auto mapped_file_address = file_mapping.addr_as<LinuxVMAddress>(); |
| 246 | CheckedWriteFile( |
| 247 | WritePipeHandle(), &mapped_file_address, sizeof(mapped_file_address)); |
| 248 | LinuxVMSize path_length = path.value().size(); |
| 249 | CheckedWriteFile(WritePipeHandle(), &path_length, sizeof(path_length)); |
| 250 | CheckedWriteFile(WritePipeHandle(), path.value().c_str(), path_length); |
| 251 | |
| 252 | CheckedReadFileAtEOF(ReadPipeHandle()); |
| 253 | } |
| 254 | |
| 255 | const size_t page_size_; |
| 256 | }; |
nothing calls this directly
no test coverage detected