summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas de Zeeuw <thomasdezeeuw@gmail.com>2021-06-03 21:49:43 +0200
committerThomas de Zeeuw <thomasdezeeuw@gmail.com>2021-06-03 21:49:43 +0200
commiteca2ea67f1f8eadaec760e624da67d7176ed4fb7 (patch)
tree6a9cce9fddc956fe6b702752d344be32c240eac1
parent1d5190618101005058d8d0e3eb8fd1e990be6882 (diff)
downloadrust-libc-eca2ea67f1f8eadaec760e624da67d7176ed4fb7.tar.gz
Add gethostuuid and uuid_t on macOS
-rwxr-xr-xlibc-test/build.rs2
-rw-r--r--src/unix/bsd/apple/mod.rs5
2 files changed, 7 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index e4f3a54e41..a5d95f0380 100755
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -361,6 +361,8 @@ fn test_apple(target: &str) {
cfg.skip_roundtrip(move |s| match s {
// FIXME: this type has the wrong ABI
"max_align_t" if i686 => true,
+ // Can't return an array from a C function.
+ "uuid_t" => true,
_ => false,
});
cfg.generate("../src/lib.rs", "main.rs");
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index 8449e9a1f0..30676ce94a 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -29,6 +29,7 @@ pub type cpu_subtype_t = integer_t;
pub type natural_t = u32;
pub type mach_msg_type_number_t = natural_t;
pub type kern_return_t = ::c_int;
+pub type uuid_t = [u8; 16];
pub type posix_spawnattr_t = *mut ::c_void;
pub type posix_spawn_file_actions_t = *mut ::c_void;
@@ -4098,6 +4099,10 @@ extern "C" {
buffersize: u32,
) -> ::c_int;
pub fn proc_libversion(major: *mut ::c_int, mintor: *mut ::c_int) -> ::c_int;
+ /// # Notes
+ ///
+ /// `id` is of type [`uuid_t`].
+ pub fn gethostuuid(id: *mut u8, timeout: *const ::timespec) -> ::c_int;
}
#[link(name = "iconv")]