Skip to content

Commit a61fd8c

Browse files
committed
Auto merge of #2066 - wmanley:preadv2-pwritev2, r=JohnTitor
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).
2 parents be0c2d4 + ce0eb23 commit a61fd8c

File tree

1 file changed

+23
-0
lines changed
  • src/unix/linux_like/linux/gnu

1 file changed

+23
-0
lines changed

src/unix/linux_like/linux/gnu/mod.rs

+23
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,15 @@ pub const EPOLLWAKEUP: ::c_int = 0x20000000;
862862
pub const SEEK_DATA: ::c_int = 3;
863863
pub const SEEK_HOLE: ::c_int = 4;
864864

865+
// linux/fs.h
866+
867+
// Flags for preadv2/pwritev2
868+
pub const RWF_HIPRI: ::c_int = 0x00000001;
869+
pub const RWF_DSYNC: ::c_int = 0x00000002;
870+
pub const RWF_SYNC: ::c_int = 0x00000004;
871+
pub const RWF_NOWAIT: ::c_int = 0x00000008;
872+
pub const RWF_APPEND: ::c_int = 0x00000010;
873+
865874
// linux/rtnetlink.h
866875
pub const TCA_PAD: ::c_ushort = 9;
867876
pub const TCA_DUMP_INVISIBLE: ::c_ushort = 10;
@@ -1423,6 +1432,20 @@ extern "C" {
14231432
dirfd: ::c_int,
14241433
path: *const ::c_char,
14251434
) -> ::c_int;
1435+
pub fn preadv2(
1436+
fd: ::c_int,
1437+
iov: *const ::iovec,
1438+
iovcnt: ::c_int,
1439+
offset: ::off_t,
1440+
flags: ::c_int,
1441+
) -> ::ssize_t;
1442+
pub fn pwritev2(
1443+
fd: ::c_int,
1444+
iov: *const ::iovec,
1445+
iovcnt: ::c_int,
1446+
offset: ::off_t,
1447+
flags: ::c_int,
1448+
) -> ::ssize_t;
14261449
}
14271450

14281451
extern "C" {

0 commit comments

Comments
 (0)