diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index f36fa61cabf49..a2e2dd75bd984 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -354,12 +354,21 @@ extern { pub fn kqueue() -> ::c_int; pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int; pub fn syscall(num: ::c_int, ...) -> ::c_int; + #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] + pub fn getpwnam_r(name: *const ::c_char, + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] pub fn getpwuid_r(uid: ::uid_t, pwd: *mut passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd) -> ::c_int; + #[cfg_attr(target_os = "netbsd", link_name = "__getpwent50")] + pub fn getpwent() -> *mut passwd; + pub fn setpwent(); pub fn getprogname() -> *const ::c_char; pub fn setprogname(name: *const ::c_char); pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 314219e78cbe3..d2ae4eaeb0578 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -17,6 +17,13 @@ pub enum DIR {} pub enum locale_t {} s! { + pub struct group { + pub gr_name: *mut ::c_char, + pub gr_passwd: *mut ::c_char, + pub gr_gid: ::gid_t, + pub gr_mem: *mut *mut ::c_char, + } + pub struct utimbuf { pub actime: time_t, pub modtime: time_t, @@ -226,6 +233,15 @@ cfg_if! { } extern { + pub fn getgrnam(name: *const ::c_char) -> *mut group; + pub fn getgrgid(gid: ::gid_t) -> *mut group; + + pub fn endpwent(); + #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")] + pub fn getpwnam(name: *const ::c_char) -> *mut passwd; + #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")] + pub fn getpwuid(uid: ::uid_t) -> *mut passwd; + pub fn fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; pub fn printf(format: *const ::c_char, ...) -> ::c_int; diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 25007fbdf9b42..a909082a5ae48 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -503,6 +503,8 @@ f! { } extern { + pub fn setpwent(); + pub fn getpwent() -> *mut passwd; pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int; pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int; diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index d625f1b721517..8280141961d1e 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -715,6 +715,11 @@ f! { } extern { + pub fn getpwnam_r(name: *const ::c_char, + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd) -> ::c_int; pub fn getpwuid_r(uid: ::uid_t, pwd: *mut passwd, buf: *mut ::c_char, diff --git a/src/unix/solaris/mod.rs b/src/unix/solaris/mod.rs index 5a31e5269bbb3..047051ef6dc5b 100644 --- a/src/unix/solaris/mod.rs +++ b/src/unix/solaris/mod.rs @@ -966,10 +966,16 @@ extern { serv: *mut ::c_char, sevlen: ::socklen_t, flags: ::c_int) -> ::c_int; + pub fn getpwnam_r(name: *const ::c_char, + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::c_int) -> *const passwd; pub fn getpwuid_r(uid: ::uid_t, pwd: *mut passwd, buf: *mut ::c_char, - buflen: ::size_t) -> *const passwd; + buflen: ::c_int) -> *const passwd; + pub fn setpwent(); + pub fn getpwent() -> *mut passwd; pub fn readdir(dirp: *mut ::DIR) -> *const ::dirent; pub fn fdatasync(fd: ::c_int) -> ::c_int; pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;