Skip to content

Commit

Permalink
fix map_val
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwei37 committed Sep 2, 2024
1 parent d4b14d6 commit 633e15a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runtime/src/bpftime_shm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down

0 comments on commit 633e15a

Please sign in to comment.