Skip to content

Commit 9f99d74

Browse files
committed
Merge pull request rust-lang#153 from kamalmarhubi/if_indextoname
unix: Add if_indextoname and IF_NAMESIZE
2 parents aa4e1b5 + 0a5dcf0 commit 9f99d74

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/unix/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ pub const POLLERR: ::c_short = 0x8;
129129
pub const POLLHUP: ::c_short = 0x10;
130130
pub const POLLNVAL: ::c_short = 0x20;
131131

132+
pub const IF_NAMESIZE: ::size_t = 16;
133+
132134
cfg_if! {
133135
if #[cfg(feature = "default")] {
134136
// cargo build, don't pull in anything extra as the libstd dep
@@ -363,6 +365,7 @@ extern {
363365
pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
364366

365367
pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint;
368+
pub fn if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char;
366369

367370
#[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")]
368371
#[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]

0 commit comments

Comments
 (0)