MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / runtime_process_image_reference_same

Function runtime_process_image_reference_same

src/daemon/runtime.c:967–992  ·  view source on GitHub ↗

True when a retained reference is still the unchanged image it captured AND * the freshly acquired peer maps that same image. Metadata only: no hashing. */

Source from the content-addressed store, hash-verified

965/* True when a retained reference is still the unchanged image it captured AND
966 * the freshly acquired peer maps that same image. Metadata only: no hashing. */
967static bool runtime_process_image_reference_same(const runtime_process_image_reference_t *held,
968 const runtime_process_image_reference_t *peer) {
969 if (!held || !held->held || !peer || !peer->held) {
970 return false;
971 }
972#ifdef _WIN32
973 BY_HANDLE_FILE_INFORMATION held_now;
974 LARGE_INTEGER held_size_now;
975 return runtime_windows_file_snapshot(held->file, &held_now, &held_size_now) &&
976 runtime_windows_file_snapshot_same(&held->information, &held->size, &held_now,
977 &held_size_now) &&
978 runtime_windows_file_snapshot_same(&held->information, &held->size, &peer->information,
979 &peer->size);
980#elif defined(__APPLE__)
981 struct stat held_now;
982 return fstat(held->fd, &held_now) == 0 && runtime_mac_stat_same(&held->status, &held_now) &&
983 runtime_mac_stat_same(&held->status, &peer->status);
984#elif defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
985 struct stat held_now;
986 return fstat(held->fd, &held_now) == 0 &&
987 runtime_posix_stat_same_image(&held->status, &held_now) &&
988 runtime_posix_stat_same_image(&held->status, &peer->status);
989#else
990 return false;
991#endif
992}
993
994/* A false result means only "not proven identical". The caller must use the
995 * full fingerprint fallback before rejecting the peer. */

Tested by

no test coverage detected