Skip to content

Fallback path for mmap #163

Closed
Closed
@database64128

Description

@database64128

If the db is on a file system without mmap support, like a remote share or some FUSE filesystem, mmap(2)/MapViewOfFile may fail. Now that we target Go 1.23+, there's an easy way to detect this with errors.Is(err, errors.ErrUnsupported) (added in Go 1.21). This seems to work quite well in my project: https://github.com/database64128/shadowsocks-go/blob/f299d1bb61ba85840dbfbf948adeb8d2b4c216c4/mmap/mmap.go#L39

If you are OK with this idea, I can open a PR to implement it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions