Skip to content
7 changes: 7 additions & 0 deletions src/unix/bsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ s! {
pub struct fsid_t {
__fsid_val: [::int32_t; 2],
}

pub struct if_nameindex {
pub if_index: ::c_uint,
pub if_name: *mut ::c_char,
}
}

pub const LC_ALL: ::c_int = 0;
Expand Down Expand Up @@ -358,6 +363,8 @@ extern {
pub fn getprogname() -> *const ::c_char;
pub fn setprogname(name: *const ::c_char);
pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
pub fn if_nameindex() -> *mut if_nameindex;
pub fn if_freenameindex(ptr: *mut if_nameindex);
}

cfg_if! {
Expand Down
8 changes: 8 additions & 0 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ s! {
#[cfg(target_pointer_width = "64")]
bits: [u64; 16],
}

pub struct if_nameindex {
pub if_index: ::c_uint,
pub if_name: *mut ::c_char,
}

}

pub const ABDAY_1: ::nl_item = 0x20000;
Expand Down Expand Up @@ -637,6 +643,8 @@ extern {
// Not available now on Android
pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
mode: ::mode_t) -> ::c_int;
pub fn if_nameindex() -> *mut if_nameindex;
pub fn if_freenameindex(ptr: *mut if_nameindex);
}

cfg_if! {
Expand Down
37 changes: 22 additions & 15 deletions src/unix/solaris/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ s! {
pub l_pid: ::pid_t,
pub l_pad: [::c_long; 4]
}

pub struct if_nameindex {
pub if_index: ::c_uint,
pub if_name: *mut ::c_char,
}
}

pub const LC_CTYPE: ::c_int = 0;
Expand Down Expand Up @@ -990,21 +995,23 @@ extern {
pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char,
newdirfd: ::c_int, newpath: *const ::c_char,
flags: ::c_int) -> ::c_int;
pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
mode: ::mode_t) -> ::c_int;
pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
mode: ::mode_t, dev: dev_t) -> ::c_int;
pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char,
buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t;
pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
newdirfd: ::c_int, newpath: *const ::c_char)
-> ::c_int;
pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int,
linkpath: *const ::c_char) -> ::c_int;
pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char,
flags: ::c_int) -> ::c_int;
pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
mode: ::mode_t) -> ::c_int;
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
mode: ::mode_t, dev: dev_t) -> ::c_int;
pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char,
buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t;
pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
newdirfd: ::c_int, newpath: *const ::c_char)
-> ::c_int;
pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int,
linkpath: *const ::c_char) -> ::c_int;
pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char,
flags: ::c_int) -> ::c_int;
pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
mode: ::mode_t) -> ::c_int;
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
pub fn if_nameindex() -> *mut if_nameindex;
pub fn if_freenameindex(ptr: *mut if_nameindex);
}