MCPcopy Create free account
hub / github.com/apple-oss-distributions/dyld / loadFile

Method loadFile

cache_builder/BuilderFileSystem.cpp:280–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280bool FileSystemMRM::loadFile(const char* path, dyld3::closure::LoadedFileInfo& info,
281 char realerPath[MAXPATHLEN], void (^error)(const char* format, ...)) const
282{
283 Diagnostics diag;
284 std::string resolvedPath = symlinkResolver.realPath(diag, path);
285 if (diag.hasError()) {
286 diag.verbose("MRM error: %s\n", diag.errorMessage().c_str());
287 diag.clearError();
288 return false;
289 }
290
291 auto it = fileMap.find(resolvedPath);
292 if (it == fileMap.end())
293 return false;
294
295 if (resolvedPath == path)
296 realerPath[0] = '\0';
297 else
298 memcpy(realerPath, resolvedPath.c_str(), std::min((size_t)MAXPATHLEN, resolvedPath.size() + 1));
299
300 // The file exists at this exact path. Lets use it!
301 const FileInfo& fileInfo = files[it->second];
302
303 info.fileContent = fileInfo.data;
304 info.fileContentLen = fileInfo.length;
305 info.sliceOffset = 0;
306 info.sliceLen = fileInfo.length;
307 info.isOSBinary = true;
308 info.inode = fileInfo.inode;
309 info.mtime = fileInfo.mtime;
310 info.unload = nullptr;
311 info.path = path;
312 return true;
313 }
314
315void FileSystemMRM::unloadFile(const dyld3::closure::LoadedFileInfo& info) const
316{

Callers 1

calculateDylibsToDeleteFunction · 0.45

Calls 8

realPathMethod · 0.80
verboseMethod · 0.80
clearErrorMethod · 0.80
hasErrorMethod · 0.45
errorMessageMethod · 0.45
findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected