Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
20 changes: 10 additions & 10 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
17 changes: 17 additions & 0 deletions src/unix/bsd/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use dox::{mem, Option};
use unix::group;

pub type wchar_t = i32;
pub type off_t = i64;
Expand Down Expand Up @@ -388,6 +389,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 Expand Up @@ -513,6 +518,18 @@ extern {
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut passwd) -> ::c_int;
#[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 passwd,
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut 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_attr(all(target_os = "macos", target_arch ="x86"),
link_name = "sigwait$UNIX2003")]
#[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
Expand Down
17 changes: 17 additions & 0 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Linux-specific definitions for linux-like values

use dox::{mem, Option};
use unix::group;

pub type useconds_t = u32;
pub type dev_t = u64;
Expand Down Expand Up @@ -1468,9 +1469,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 Expand Up @@ -1826,6 +1831,18 @@ extern {
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut passwd) -> ::c_int;
#[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 passwd,
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut 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_attr(all(target_os = "macos", target_arch ="x86"),
link_name = "sigwait$UNIX2003")]
#[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
Expand Down