fix socketpair() implementation to build on Illumos
This commit is contained in:
1 parent
56e9a9af7e
commit
337959f1f4
1 file changed
+6
-1
@@ -392,7 +392,12 @@ pub fn socketpair_impl() -> Result<(FileDescriptor, FileDescriptor)> {
|
||||
#[doc(hidden)]
|
||||
pub fn socketpair_impl() -> Result<(FileDescriptor, FileDescriptor)> {
|
||||
let mut fds = [-1i32; 2];
|
||||
let res = unsafe { libc::socketpair(libc::PF_LOCAL, libc::SOCK_STREAM, 0, fds.as_mut_ptr()) };
|
||||
#[cfg(target_os = "illumos")]
|
||||
let domain = libc::AF_UNIX;
|
||||
#[cfg(not(target_os = "illumos"))]
|
||||
let domain = libc::PF_LOCAL;
|
||||
|
||||
let res = unsafe { libc::socketpair(domain, libc::SOCK_STREAM, 0, fds.as_mut_ptr()) };
|
||||
if res == -1 {
|
||||
Err(Error::Socketpair(std::io::Error::last_os_error()))
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user