rr icon indicating copy to clipboard operation
rr copied to clipboard

Support `preadv2/pwritev2`

Open Sonicadvance1 opened this issue 3 years ago • 3 comments

These were added in Kernel 4.6 and they are quite similar to preadv and pwritev but adds a flags argument to tweak the behaviour.

The newest flag is RWF_APPEND which was added in 4.16.

I'm not sure exactly how these would be implemented but I noticed the application I was attempting to debug used these. So it would be nice if it was supported.

Sonicadvance1 avatar Apr 25 '22 20:04 Sonicadvance1

Can you share what application this is? I'm particularly interested in whether glibc or something common has picked these up.

None of the RWF_foo flags change any behavior rr cares about, so this is straightforward to implement. The preadv2 entry in src/syscalls.py needs to be changed from UnsupportedSyscall to IrregularEmulatedSyscall (to match preadv), and then the places that handle Arch::preadv throughout rr also need to handle preadv2. Similarly with pwritev2 (although this can just be an EmulatedSyscall), and then tests are needed.

khuey avatar Apr 25 '22 21:04 khuey

https://github.com/FEX-Emu/FEX/pull/1548 FEX-Emu is using the glibc provided wrapper directly in this PR. Specifically for the RWF_APPEND flag.

Sonicadvance1 avatar Apr 25 '22 22:04 Sonicadvance1

Ok.

This would be fairly straightforward if you feel like doing it, following the instructions above.

khuey avatar Apr 25 '22 23:04 khuey