summaryrefslogtreecommitdiff
path: root/libc/src/unix/notbsd/linux/mod.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2017-05-29 14:07:12 -0700
committerDaniel Mueller <deso@posteo.net>2017-05-29 14:07:12 -0700
commit684c4574c09a6f2cc5a208e4505e9306602b4abc (patch)
treedaaac715140748c82f801f2e4047c57780689bc0 /libc/src/unix/notbsd/linux/mod.rs
parent436915453f7474117234aa0cedab6f97b3b3575f (diff)
downloadnitrocli-684c4574c09a6f2cc5a208e4505e9306602b4abc.tar.gz
nitrocli-684c4574c09a6f2cc5a208e4505e9306602b4abc.tar.bz2
Update libc crate to 0.2.23
The 'libc' create got a couple of updates. This change imports the new code and bumps the version to use. Import subrepo libc/:libc at 7db3fd570dfb41a38fb17116e93679307178103a
Diffstat (limited to 'libc/src/unix/notbsd/linux/mod.rs')
-rw-r--r--libc/src/unix/notbsd/linux/mod.rs45
1 files changed, 45 insertions, 0 deletions
diff --git a/libc/src/unix/notbsd/linux/mod.rs b/libc/src/unix/notbsd/linux/mod.rs
index 9774f93..b9375a3 100644
--- a/libc/src/unix/notbsd/linux/mod.rs
+++ b/libc/src/unix/notbsd/linux/mod.rs
@@ -220,6 +220,11 @@ s! {
pub msgtql: ::c_int,
pub msgseg: ::c_ushort,
}
+
+ pub struct mmsghdr {
+ pub msg_hdr: ::msghdr,
+ pub msg_len: ::c_uint,
+ }
}
pub const ABDAY_1: ::nl_item = 0x20000;
@@ -692,6 +697,14 @@ pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2;
pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3;
pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4;
+pub const XATTR_CREATE: ::c_int = 0x1;
+pub const XATTR_REPLACE: ::c_int = 0x2;
+
+// On Linux, libc doesn't define this constant, libattr does instead.
+// We still define it for Linux as it's defined by libc on other platforms,
+// and it's mentioned in the man pages for getxattr and setxattr.
+pub const ENOATTR: ::c_int = ::ENODATA;
+
f! {
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
for slot in cpuset.bits.iter_mut() {
@@ -722,6 +735,31 @@ f! {
pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
set1.bits == set2.bits
}
+
+ pub fn major(dev: ::dev_t) -> ::c_uint {
+ let mut major = 0;
+ major |= (dev & 0x00000000000fff00) >> 8;
+ major |= (dev & 0xfffff00000000000) >> 32;
+ major as ::c_uint
+ }
+
+ pub fn minor(dev: ::dev_t) -> ::c_uint {
+ let mut minor = 0;
+ minor |= (dev & 0xfffff00000000000) >> 0;
+ minor |= (dev & 0x00000ffffff00000) >> 12;
+ minor as ::c_uint
+ }
+
+ pub fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
+ let major = major as ::dev_t;
+ let minor = minor as ::dev_t;
+ let mut dev = 0;
+ dev |= (major & 0x00000fff) << 8;
+ dev |= (major & 0xfffff000) << 32;
+ dev |= (minor & 0x000000ff) << 0;
+ dev |= (minor & 0xffffff00) << 12;
+ dev
+ }
}
extern {
@@ -958,6 +996,13 @@ extern {
-> ::ssize_t;
}
+extern {
+ pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
+ flags: ::c_int) -> ::c_int;
+ pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
+ flags: ::c_int, timeout: *mut ::timespec) -> ::c_int;
+}
+
cfg_if! {
if #[cfg(any(target_env = "musl",
target_os = "fuchsia",