vgteam / libbdsg

Optimized sequence graph implementations for graph genomics
MIT License
30 stars 6 forks source link

Map read-only when needed #184

Closed adamnovak closed 1 year ago

adamnovak commented 1 year ago

This changes the memory-mapping system to detect when a file is not writable, and map it read-only instead of read-write.

I've turned off setting the direct-jump flags in the pointers and trying to trim the file on close, in those cases, but the read-only-ness isn't enforced with const-ness of the UniqueMappedPointer and will show up as a segfault if you load from a read-only file and then try to write.