From 633e15aeea8fab353d9fa67c68a7c580af0502ad Mon Sep 17 00:00:00 2001 From: yunwei37 Date: Mon, 2 Sep 2024 02:08:28 +0000 Subject: [PATCH] fix map_val --- runtime/src/bpftime_shm.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/src/bpftime_shm.cpp b/runtime/src/bpftime_shm.cpp index 91075019..4dd3ccb3 100644 --- a/runtime/src/bpftime_shm.cpp +++ b/runtime/src/bpftime_shm.cpp @@ -568,13 +568,13 @@ extern "C" uint64_t map_ptr_by_fd(uint32_t fd) return INVALID_MAP_PTR; } // Use a convenient way to represent a pointer - return ((uint64_t)fd << 32) | 0xffffffff; + return fd; } extern "C" uint64_t map_val(uint64_t map_ptr) { SPDLOG_DEBUG("Call map_val with map_ptr={:x}", map_ptr); - int fd = (int)(map_ptr >> 32); + int fd = (int)map_ptr; if (!shm_holder.global_shared_memory.get_manager() || !shm_holder.global_shared_memory.is_map_fd(fd)) { SPDLOG_ERROR("Expected fd {} to be a map fd (map_val call)",