Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

name = "libc"
version = "0.2.37"
version = "0.2.38"
authors = ["The Rust Project Developers"]
license = "MIT/Apache-2.0"
readme = "README.md"
Expand Down
3 changes: 3 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,9 @@ fn main() {
// the symbol.
"uname" if freebsd => true,

// FIXME: need to upgrade FreeBSD version; see https://github.com/rust-lang/libc/issues/938
"setgrent" if freebsd => true,

// aio_waitcomplete's return type changed between FreeBSD 10 and 11.
"aio_waitcomplete" if freebsd => true,

Expand Down
4 changes: 4 additions & 0 deletions src/unix/bsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ extern {
pub fn getpwent() -> *mut passwd;
pub fn setpwent();
pub fn endpwent();
pub fn setgrent();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setgrent is not available in freebsd (or it looks like this is the case), you are going to have to put it in the folders of all bsd targets except for the freebsd one :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@gnzlbg gnzlbg Mar 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setgrent is available in FreeBSD. What gives you the impression it isn't?

Indeed, this buildbot: https://travis-ci.org/rust-lang/libc/jobs/347737123#L1402

Says that the pointer types are incompatible. It looks like its signature was changed in: freebsd/freebsd-src@786c392

from int setgrent() to void setgrent(). That commit was 2 years ago, but it might be that we are testing against a FreeBSD release that is older as the release where that commit was included.

You might want to change the signature to int setgrent() and see if that fixes the build. If so, please open an issue about updating the FreeBSD version. Ideally we would do that in a different PR, and then update everything that breaks (like making setgrent void setgrent()).

Copy link
Contributor

@gnzlbg gnzlbg Mar 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it turns out to be the case that changing the signature to int setgrent() fixes this issue, what you can also do is change it back afterwards to void setgrent() and whitelist the function here: https://github.com/rust-lang/libc/blob/master/libc-test/build.rs#L606

By adding a match arm like this:

// FIXME: need to upgrade FreeBSD version. Issue: rust-lang/libc/xxxxxx
"setgrent" if freebsd => true,

This basically disables testing for the setgrent function for FreeBSD.

pub fn endgrent();
pub fn getgrent() -> *mut ::group;

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;
Expand Down
9 changes: 9 additions & 0 deletions src/unix/bsd/netbsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,15 @@ 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;
Expand Down
4 changes: 4 additions & 0 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1468,9 +1468,13 @@ extern {
pub fn setpwent();
pub fn endpwent();
pub fn getpwent() -> *mut passwd;
pub fn setgrent();
pub fn endgrent();
pub fn getgrent() -> *mut ::group;
pub fn setspent();
pub fn endspent();
pub fn getspent() -> *mut spwd;

pub fn getspnam(__name: *const ::c_char) -> *mut spwd;

pub fn shm_open(name: *const c_char, oflag: ::c_int,
Expand Down
13 changes: 13 additions & 0 deletions src/unix/notbsd/linux/other/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,19 @@ extern {
pub fn mallinfo() -> ::mallinfo;
pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t;
pub fn getauxval(type_: ::c_ulong) -> ::c_ulong;
#[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")]
#[cfg_attr(target_os = "solaris", link_name = "__posix_getpwent_r")]
pub fn getpwent_r(pwd: *mut ::unix::notbsd::linux::passwd,
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut ::unix::notbsd
::linux::passwd) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__getgrent_r50")]
#[cfg_attr(target_os = "solaris", link_name = "__posix_getgrent_r")]
pub fn getgrent_r(grp: *mut ::group,
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut ::group) -> ::c_int;
}

cfg_if! {
Expand Down
10 changes: 10 additions & 0 deletions src/unix/solaris/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,16 @@ extern {
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut passwd) -> ::c_int;
#[cfg_attr(target_os = "solaris", link_name = "__posix_getpwent_r")]
pub fn getpwent_r(pwd: *mut passwd,
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut passwd) -> ::c_int;
#[cfg_attr(target_os = "solaris", link_name = "__posix_getgrent_r")]
pub fn getgrent_r(grp: *mut ::group,
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut ::group) -> ::c_int;
#[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
pub fn sigwait(set: *const sigset_t,
sig: *mut ::c_int) -> ::c_int;
Expand Down