From 5d42e0a19feeeaa1b6f62e399023fcff021e23f9 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Thu, 18 Aug 2022 21:56:49 +0100 Subject: [PATCH] IEEE EUI-64 callss for freebsd/dragonflybsd. --- libc-test/build.rs | 2 ++ libc-test/semver/dragonfly.txt | 4 ++++ libc-test/semver/freebsd.txt | 4 ++++ src/unix/bsd/freebsdlike/mod.rs | 11 +++++++++++ 4 files changed, 21 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index 4b34ae67bac3b..ea4c625155873 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -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", @@ -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", diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt index e58d636489bc7..448b4fb4f4bc6 100644 --- a/libc-test/semver/dragonfly.txt +++ b/libc-test/semver/dragonfly.txt @@ -1248,6 +1248,10 @@ endgrent endpwent endservent endutxent +eui64_aton +eui64_hostton +eui64_ntoa +eui64_ntohost exit_status explicit_bzero faccessat diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 59a724bf49660..bdb614578a700 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -1515,6 +1515,10 @@ endpwent endservent endutxent erand48 +eui64_aton +eui64_hostton +eui64_ntoa +eui64_ntohost explicit_bzero extattr_delete_fd extattr_delete_file diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index b314b68568c84..3bf083c5ca9d5 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -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! { @@ -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; @@ -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")]