Skip to content

Commit

Permalink
posix definitions should be used on Solaris
Browse files Browse the repository at this point in the history
For compatibility reasons, Solaris historically had its header files
setup so that, unless specifically requested through specific header
defines, either the old pre-POSIX interfaces or POSIX.1c Draft 6
interfaces were used. However, in the case of rust, since these symbols
are linked directly instead of via system header files, the underlying
posix symbol name can be used directly instead.

These definitions should be corrected to match what they do on almost
every other platform.

Be aware this is a breaking change in terms of interface for any crates
/ consumers of these interfaces for Solaris.

Fixes rust-lang#522
  • Loading branch information
binarycrusader committed Feb 16, 2017
1 parent 53bb038 commit 6740a8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ extern {
pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
#[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
#[cfg_attr(target_os = "solaris", link_name = "__posix_readdir_r")]
pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent,
result: *mut *mut ::dirent) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
Expand Down Expand Up @@ -638,6 +639,7 @@ extern {
oss: *mut stack_t) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch ="x86"),
link_name = "sigwait$UNIX2003")]
#[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
pub fn sigwait(set: *const sigset_t,
sig: *mut ::c_int) -> ::c_int;

Expand Down
9 changes: 7 additions & 2 deletions src/unix/solaris/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,14 +1023,19 @@ extern {
serv: *mut ::c_char,
sevlen: ::socklen_t,
flags: ::c_int) -> ::c_int;
#[link_name = "__posix_getpwnam_r"]
pub fn getpwnam_r(name: *const ::c_char,
pwd: *mut passwd,
buf: *mut ::c_char,
buflen: ::c_int) -> *const passwd;
buflen: ::size_t,
result: *mut *mut passwd) -> ::c_int;

#[link_name = "__posix_getpwuid_r"]
pub fn getpwuid_r(uid: ::uid_t,
pwd: *mut passwd,
buf: *mut ::c_char,
buflen: ::c_int) -> *const passwd;
buflen: ::size_t,
result: *mut *mut passwd) -> ::c_int;
pub fn setpwent();
pub fn getpwent() -> *mut passwd;
pub fn readdir(dirp: *mut ::DIR) -> *const ::dirent;
Expand Down

0 comments on commit 6740a8a

Please sign in to comment.