Skip to content

Commit

Permalink
Auto merge of #2066 - wmanley:preadv2-pwritev2, r=JohnTitor
Browse files Browse the repository at this point in the history
Linux: Add `preadv2` and `pwritev2` and associated constants

These functions are the same as `preadv` and `pwritev` but have a flags
parameter.  `preadv2()` and `pwritev2()` first appeared in Linux 4.6.
Library support was added in glibc 2.26.

See the definition of the constants in [linux/fs.h](https://github.com/torvalds/linux/blob/fcadab740480e0e0e9fa9bd272acd409884d431a/tools/include/uapi/linux/fs.h#L288-L301).
  • Loading branch information
bors committed Feb 12, 2021
2 parents be0c2d4 + ce0eb23 commit a61fd8c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/unix/linux_like/linux/gnu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,15 @@ pub const EPOLLWAKEUP: ::c_int = 0x20000000;
pub const SEEK_DATA: ::c_int = 3;
pub const SEEK_HOLE: ::c_int = 4;

// linux/fs.h

// Flags for preadv2/pwritev2
pub const RWF_HIPRI: ::c_int = 0x00000001;
pub const RWF_DSYNC: ::c_int = 0x00000002;
pub const RWF_SYNC: ::c_int = 0x00000004;
pub const RWF_NOWAIT: ::c_int = 0x00000008;
pub const RWF_APPEND: ::c_int = 0x00000010;

// linux/rtnetlink.h
pub const TCA_PAD: ::c_ushort = 9;
pub const TCA_DUMP_INVISIBLE: ::c_ushort = 10;
Expand Down Expand Up @@ -1423,6 +1432,20 @@ extern "C" {
dirfd: ::c_int,
path: *const ::c_char,
) -> ::c_int;
pub fn preadv2(
fd: ::c_int,
iov: *const ::iovec,
iovcnt: ::c_int,
offset: ::off_t,
flags: ::c_int,
) -> ::ssize_t;
pub fn pwritev2(
fd: ::c_int,
iov: *const ::iovec,
iovcnt: ::c_int,
offset: ::off_t,
flags: ::c_int,
) -> ::ssize_t;
}

extern "C" {
Expand Down

0 comments on commit a61fd8c

Please sign in to comment.