Smithay / wayland-kbd

Keyboard utilities for the wayland-client library. Mainly handling keymaps with the help of libxkbcommon.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider switching from mmap to memmap

retep998 opened this issue · comments

Hmm, yeah indeed. Thanks for pointing this out.

I'll tackle this as soon as I have some time, it should be pretty straightforward.

Hmm... After some digging, I can't find a way to create a memory-map from a linux file descriptor in memmap-rs, which is exactly the feature I'm using in mmap: https://github.com/vberger/wayland-kbd/blob/master/src/mapped_keyboard.rs#L153-L156

@danburkert Nudge, nudge.

Wait, you can do this already. On unix platforms you have FromRawFd impl'd on File so you can use that to get a File which you can then pass to memmap.

Yah the Mmap::open_with_offset function should work. That being said, I've never tested against non-file-backed 'files'.

Fair point. I'll try this tomorrow.

@vberger Did you ever look into this? Did it end up being non-trivial?

Hmm, kinda forgot this, sorry for that...

I won't have time to spend on it for the next two weeks unfortunately... :-/

I won't have time to spend on it for the next two weeks unfortunately... :-/

All good!

Opened a PR for this whenever you have time: #9