Skip to content

Commit 7a3754f

Browse files
committed
Auto merge of #523 - binarycrusader:master, r=alexcrichton
posix definitions should be used on Solaris 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 #522
2 parents 53bb038 + 6740a8a commit 7a3754f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/unix/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ extern {
352352
pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
353353
#[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
354354
#[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
355+
#[cfg_attr(target_os = "solaris", link_name = "__posix_readdir_r")]
355356
pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent,
356357
result: *mut *mut ::dirent) -> ::c_int;
357358
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
@@ -638,6 +639,7 @@ extern {
638639
oss: *mut stack_t) -> ::c_int;
639640
#[cfg_attr(all(target_os = "macos", target_arch ="x86"),
640641
link_name = "sigwait$UNIX2003")]
642+
#[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
641643
pub fn sigwait(set: *const sigset_t,
642644
sig: *mut ::c_int) -> ::c_int;
643645

src/unix/solaris/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,14 +1023,19 @@ extern {
10231023
serv: *mut ::c_char,
10241024
sevlen: ::socklen_t,
10251025
flags: ::c_int) -> ::c_int;
1026+
#[link_name = "__posix_getpwnam_r"]
10261027
pub fn getpwnam_r(name: *const ::c_char,
10271028
pwd: *mut passwd,
10281029
buf: *mut ::c_char,
1029-
buflen: ::c_int) -> *const passwd;
1030+
buflen: ::size_t,
1031+
result: *mut *mut passwd) -> ::c_int;
1032+
1033+
#[link_name = "__posix_getpwuid_r"]
10301034
pub fn getpwuid_r(uid: ::uid_t,
10311035
pwd: *mut passwd,
10321036
buf: *mut ::c_char,
1033-
buflen: ::c_int) -> *const passwd;
1037+
buflen: ::size_t,
1038+
result: *mut *mut passwd) -> ::c_int;
10341039
pub fn setpwent();
10351040
pub fn getpwent() -> *mut passwd;
10361041
pub fn readdir(dirp: *mut ::DIR) -> *const ::dirent;

0 commit comments

Comments
 (0)