Skip to content

unix: add support for libc::readv and libc::writev #4048

Open
@mstoeckl

Description

@mstoeckl

readv and writev are vectored versions of read/write which are included in POSIX. (See e.g. man 3p readv, writev .) They could be (and sometimes have been) implemented using a loop and many read or write calls, so their semantics are not unusual.

I was advised to make this issue by the following error message:

test test ... error: unsupported operation: can't call foreign function `readv` on OS `linux`
   --> src/test.rs:125:19
    |
125 |         let ret = libc::readv(src_fd.as_raw_fd(), iovs.as_ptr(), iovs.len() as _);
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function `readv` on OS `linux`
    |
    = help: if this is a basic API commonly used on this target, please report an issue with Miri
    = help: however, note that Miri does not aim to support every FFI function out there; for instance, we will not support APIs for things such as GUIs, scripting languages, or databases

A workaround for this error: under cfg(miri), replace libc::readv/libc::writev with functions that implement them using libc::read/libc::write directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-shimsArea: This affects the external function shimsA-unixArea: affects our shared Unix target supportC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancementE-good-second-issueA good issue to pick up if you've already seen some parts of Miri, mentoring is available

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions