Repository navigation
Conversation
…refixes
- is_valid_name() rejected every name containing a backslash, so
shared_memory("Global\\my_shm", 1024, create_only) failed with
errc::invalid_name even though the README and platform notes advertise and
demonstrate exactly that form.
- Allow a leading Global\, Local\ or Session\<id>\ object namespace prefix,
matched case-insensitively as the kernel does; a backslash past the prefix,
or a prefix with no object name after it, is still invalid.
- Add tests for the accepted prefixes, malformed prefixes, and creating and
opening a Local\ prefixed segment.
- Update platform notes, README and changelog to match.
- create() returned map_impl() directly, so a mapping failure on a segment this call had just created skipped the unlink that the fstat/ftruncate error paths perform; close() never unlinks, leaving the segment in /dev/shm until removed by hand. - Route the mapping failure through cleanup_error(), which unlinks only when owns_shm_ is set. - Add a POSIX regression test asserting that a failed create leaves nothing behind; verified it fails before the fix and passes after. - Update platform notes and changelog.
- open() returned map_impl() directly, so a mapping failure left the fd open until the object was destroyed - inconsistent with the fstat() error path just above, and observable for a no-throw construction whose failed object stays alive. - Add a regression test that counts descriptors while the failed object is still in scope; verified it fails before the fix and passes after.
- create() passed PAGE_READONLY to CreateFileMapping when a segment was created read_only, making the section read-only for every process forever; no later opener could map it for writing. The same code on POSIX opens O_RDWR and only mmaps PROT_READ, leaving the segment writable for others. - Always create the section PAGE_READWRITE and let get_map_access() restrict this process's view, so read_only means the same thing on both platforms. Verified the creator's own view is still read-only (PAGE_READONLY / r--s). - Add a test that a read-only creator does not lock out a read-write opener; verified it fails before the fix and passes after. - Document the semantics in the API reference and platform notes.
- api_reference.md said "Always create (truncate if exists)", but only Linux resizes an existing segment: macOS resizes only when no other process holds it open, and Windows never resizes at all - neither growing nor shrinking. size() can therefore come back smaller than requested, and on Linux an existing segment can be shrunk while other processes have it mapped. - Add a per-platform table and the size() check idiom to the API reference, broaden the macOS-only note in the platform notes, and add a README best-practice line. - Pin the per-platform outcome with a test; macOS is left unasserted since it depends on whether the segment is held open elsewhere.
- unique_name() and shm_cleanup were copy-pasted verbatim across four test files; move them to tests/test_helpers.hpp in a named slick_shm_test namespace, with unique_name marked inline. - Drop the now-unused <chrono> includes and the anonymous namespaces left empty; count_open_fds() stays local to test_error_handling.cpp. - List the header in the test target so it appears in IDE project views.
- The view dropped its owned std::string for a borrowed const char*, which went stale whenever the source shared_memory was moved: small names live inside the string object, so a move left the pointer aimed at the moved-from object. Length-dependent and silent - long names survived, short ones did not, and a std::vector<shared_memory> reallocation broke it while satisfying the documented "source must outlive the view" rule. - Store the name behind shared_memory::name() in address-stable storage (detail::stable_name) so a move transfers a pointer and leaves the characters put. sizeof(shared_memory_view) 56 -> 32 with noexcept copies, sizeof(shared_memory) 112 -> 88. - Reject constructing a view from a temporary at compile time. - Add tests/test_view.cpp; the class had no coverage. Verified the move, move-assign and vector-realloc cases fail without the stable storage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.