Skip to content

Commit

Permalink
Auto merge of #2882 - devnexen:eui64_fbsd, r=JohnTitor
Browse files Browse the repository at this point in the history
IEEE EUI-64 callss for freebsd/dragonflybsd.
  • Loading branch information
bors committed Aug 21, 2022
2 parents 9358dbf + 5d42e0a commit 7c04c75
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libc-test/build.rs
Expand Up @@ -1224,6 +1224,7 @@ fn test_dragonflybsd(target: &str) {
"sys/file.h",
"sys/ioctl.h",
"sys/cpuctl.h",
"sys/eui64.h",
"sys/ipc.h",
"sys/kinfo.h",
"sys/ktrace.h",
Expand Down Expand Up @@ -1889,6 +1890,7 @@ fn test_freebsd(target: &str) {
"sys/auxv.h",
"sys/cpuset.h",
"sys/domainset.h",
"sys/eui64.h",
"sys/event.h",
[freebsd13]:"sys/eventfd.h",
"sys/extattr.h",
Expand Down
4 changes: 4 additions & 0 deletions libc-test/semver/dragonfly.txt
Expand Up @@ -1248,6 +1248,10 @@ endgrent
endpwent
endservent
endutxent
eui64_aton
eui64_hostton
eui64_ntoa
eui64_ntohost
exit_status
explicit_bzero
faccessat
Expand Down
4 changes: 4 additions & 0 deletions libc-test/semver/freebsd.txt
Expand Up @@ -1523,6 +1523,10 @@ endpwent
endservent
endutxent
erand48
eui64_aton
eui64_hostton
eui64_ntoa
eui64_ntohost
explicit_bzero
extattr_delete_fd
extattr_delete_file
Expand Down
11 changes: 11 additions & 0 deletions src/unix/bsd/freebsdlike/mod.rs
Expand Up @@ -376,6 +376,10 @@ s! {
pub seq: ::c_ushort,
pub key: ::key_t,
}

pub struct eui64 {
pub octet: [u8; EUI64_LEN],
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -1329,6 +1333,8 @@ pub const ONLRET: ::tcflag_t = 0x40;

pub const CMGROUP_MAX: usize = 16;

pub const EUI64_LEN: usize = 8;

// https://github.com/freebsd/freebsd/blob/master/sys/net/bpf.h
pub const BPF_ALIGNMENT: usize = SIZEOF_LONG;

Expand Down Expand Up @@ -1720,6 +1726,11 @@ extern "C" {
pub fn memset_s(s: *mut ::c_void, smax: ::size_t, c: ::c_int, n: ::size_t) -> ::c_int;
pub fn gethostid() -> ::c_long;
pub fn sethostid(hostid: ::c_long);

pub fn eui64_aton(a: *const ::c_char, e: *mut eui64) -> ::c_int;
pub fn eui64_ntoa(id: *const eui64, a: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn eui64_ntohost(hostname: *mut ::c_char, len: ::size_t, id: *const eui64) -> ::c_int;
pub fn eui64_hostton(hostname: *const ::c_char, id: *mut eui64) -> ::c_int;
}

#[link(name = "rt")]
Expand Down

0 comments on commit 7c04c75

Please sign in to comment.