@@ -37,6 +37,7 @@ class platform_shared_memory {
3737 : shm_fd_(other.shm_fd_),
3838 mapped_addr_ (other.mapped_addr_),
3939 name_(std::move(other.name_)),
40+ original_name_(std::move(other.original_name_)),
4041 size_(other.size_),
4142 mode_(other.mode_),
4243 owns_shm_(other.owns_shm_) {
@@ -53,6 +54,7 @@ class platform_shared_memory {
5354 shm_fd_ = other.shm_fd_ ;
5455 mapped_addr_ = other.mapped_addr_ ;
5556 name_ = std::move (other.name_ );
57+ original_name_ = std::move (other.original_name_ );
5658 size_ = other.size_ ;
5759 mode_ = other.mode_ ;
5860 owns_shm_ = other.owns_shm_ ;
@@ -74,7 +76,8 @@ class platform_shared_memory {
7476 return make_error_code (errc::invalid_size);
7577 }
7678
77- name_ = format_name (name);
79+ original_name_ = name; // Store original name for accessor
80+ name_ = format_name (name); // Store formatted name for POSIX API
7881 size_ = size;
7982 mode_ = access;
8083
@@ -123,7 +126,8 @@ class platform_shared_memory {
123126 return make_error_code (errc::invalid_name);
124127 }
125128
126- name_ = format_name (name);
129+ original_name_ = name; // Store original name for accessor
130+ name_ = format_name (name); // Store formatted name for POSIX API
127131 mode_ = access;
128132 owns_shm_ = false ; // We didn't create it, so don't unlink it
129133
@@ -173,7 +177,7 @@ class platform_shared_memory {
173177 }
174178
175179 const char * name () const noexcept {
176- return name_ .c_str ();
180+ return original_name_ .c_str ();
177181 }
178182
179183 bool is_valid () const noexcept {
@@ -210,7 +214,8 @@ class platform_shared_memory {
210214private:
211215 int shm_fd_ = -1 ;
212216 void * mapped_addr_ = nullptr ;
213- std::string name_;
217+ std::string name_; // Formatted name with "/" prefix for POSIX API
218+ std::string original_name_; // Original name without prefix for public accessor
214219 std::size_t size_ = 0 ;
215220 access_mode mode_ = access_mode::read_write;
216221 bool owns_shm_ = false ; // Track if we created it (for unlinking)
0 commit comments