From 6b20b3761cbe4ce3e0a38ba94f7a4382e484516b Mon Sep 17 00:00:00 2001 From: Wictor Lund Date: Wed, 7 Mar 2018 18:11:42 +0200 Subject: [PATCH] getpwent_r() and getgrent_r() exists in NetBSD, but not in OpenBSD and Bitrig. --- src/unix/bsd/netbsdlike/mod.rs | 9 --------- src/unix/bsd/netbsdlike/netbsd/mod.rs | 13 +++++++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index 397fce7d..647e25dc 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -637,15 +637,6 @@ extern { groups: *mut ::gid_t, ngroups: *mut ::c_int) -> ::c_int; pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")] - pub fn getpwent_r(pwd: *mut ::passwd, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut ::passwd) -> ::c_int; - pub fn getgrent_r(grp: *mut ::group, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut ::group) -> ::c_int; pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char, envp: *const *const ::c_char) -> ::c_int; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 4c528b56..e4c4ea1d 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1074,5 +1074,18 @@ extern { pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int; } +#[link(name = "util")] +extern { + #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")] + pub fn getpwent_r(pwd: *mut ::passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::passwd) -> ::c_int; + pub fn getgrent_r(grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group) -> ::c_int; +} + mod other; pub use self::other::*;