Skip to content

Commit eca2ea6

Browse files
committed
Add gethostuuid and uuid_t on macOS
1 parent 1d51906 commit eca2ea6

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

libc-test/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ fn test_apple(target: &str) {
361361
cfg.skip_roundtrip(move |s| match s {
362362
// FIXME: this type has the wrong ABI
363363
"max_align_t" if i686 => true,
364+
// Can't return an array from a C function.
365+
"uuid_t" => true,
364366
_ => false,
365367
});
366368
cfg.generate("../src/lib.rs", "main.rs");

src/unix/bsd/apple/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub type cpu_subtype_t = integer_t;
2929
pub type natural_t = u32;
3030
pub type mach_msg_type_number_t = natural_t;
3131
pub type kern_return_t = ::c_int;
32+
pub type uuid_t = [u8; 16];
3233

3334
pub type posix_spawnattr_t = *mut ::c_void;
3435
pub type posix_spawn_file_actions_t = *mut ::c_void;
@@ -4098,6 +4099,10 @@ extern "C" {
40984099
buffersize: u32,
40994100
) -> ::c_int;
41004101
pub fn proc_libversion(major: *mut ::c_int, mintor: *mut ::c_int) -> ::c_int;
4102+
/// # Notes
4103+
///
4104+
/// `id` is of type [`uuid_t`].
4105+
pub fn gethostuuid(id: *mut u8, timeout: *const ::timespec) -> ::c_int;
41014106
}
41024107

41034108
#[link(name = "iconv")]

0 commit comments

Comments
 (0)