Skip to content

Commit 84963e1

Browse files
committed
Auto merge of #31078 - nbaksalyar:illumos, r=alexcrichton
This pull request adds support for [Illumos](http://illumos.org/)-based operating systems: SmartOS, OpenIndiana, and others. For now it's x86-64 only, as I'm not sure if 32-bit installations are widespread. This PR is based on #28589 by @potatosalad, and also closes #21000, #25845, and #25846. Required changes in libc are already merged: rust-lang/libc#138 Here's a snapshot required to build a stage0 compiler: https://s3-eu-west-1.amazonaws.com/nbaksalyar/rustc-sunos-snapshot.tar.gz It passes all checks from `make check`. There are some changes I'm not quite sure about, e.g. macro usage in `src/libstd/num/f64.rs` and `DirEntry` structure in `src/libstd/sys/unix/fs.rs`, so any comments on how to rewrite it better would be greatly appreciated. Also, LLVM configure script might need to be patched to build it successfully, or a pre-built libLLVM should be used. Some details can be found here: https://llvm.org/bugs/show_bug.cgi?id=25409 Thanks! r? @brson
2 parents fd6f27b + 363b0ea commit 84963e1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

flock.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,25 @@ mod imp {
111111
pub const F_SETLKW: libc::c_int = 9;
112112
}
113113

114+
#[cfg(target_os = "solaris")]
115+
mod os {
116+
use libc;
117+
118+
pub struct flock {
119+
pub l_type: libc::c_short,
120+
pub l_whence: libc::c_short,
121+
pub l_start: libc::off_t,
122+
pub l_len: libc::off_t,
123+
pub l_sysid: libc::c_int,
124+
pub l_pid: libc::pid_t,
125+
}
126+
127+
pub const F_WRLCK: libc::c_short = 2;
128+
pub const F_UNLCK: libc::c_short = 3;
129+
pub const F_SETLK: libc::c_int = 6;
130+
pub const F_SETLKW: libc::c_int = 7;
131+
}
132+
114133
pub struct Lock {
115134
fd: libc::c_int,
116135
}

0 commit comments

Comments
 (0)