Skip to content

Commit 65b16b3

Browse files
committed
Auto merge of #3310 - inferiorhumanorgans:solaris-no-flock, r=JohnTitor
Don't include flock support on Solaris This should disable the flock wrapper and related consts on Solaris, but leave them in place for OpenSolaris derivatives like Illumos which do have a BSD-esque flock.
2 parents 9447d17 + 076f240 commit 65b16b3

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/unix/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,11 @@ extern "C" {
10671067
)]
10681068
pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char;
10691069

1070-
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
1070+
cfg_if! {
1071+
if #[cfg(not(target_os = "solaris"))] {
1072+
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
1073+
}
1074+
}
10711075

10721076
#[cfg_attr(target_os = "netbsd", link_name = "__times13")]
10731077
pub fn times(buf: *mut ::tms) -> ::clock_t;

src/unix/solarish/illumos.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ pub const TCP_KEEPCNT: ::c_int = 35;
3333
pub const TCP_KEEPINTVL: ::c_int = 36;
3434
pub const TCP_CONGESTION: ::c_int = 37;
3535

36+
pub const LOCK_SH: ::c_int = 1;
37+
pub const LOCK_EX: ::c_int = 2;
38+
pub const LOCK_NB: ::c_int = 4;
39+
pub const LOCK_UN: ::c_int = 8;
40+
3641
// These constants are correct for 64-bit programs or 32-bit programs that are
3742
// not using large-file mode. If Rust ever supports anything other than 64-bit
3843
// compilation on illumos, this may require adjustment:

src/unix/solarish/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,11 +1917,6 @@ pub const SHUT_RD: ::c_int = 0;
19171917
pub const SHUT_WR: ::c_int = 1;
19181918
pub const SHUT_RDWR: ::c_int = 2;
19191919

1920-
pub const LOCK_SH: ::c_int = 1;
1921-
pub const LOCK_EX: ::c_int = 2;
1922-
pub const LOCK_NB: ::c_int = 4;
1923-
pub const LOCK_UN: ::c_int = 8;
1924-
19251920
pub const F_RDLCK: ::c_short = 1;
19261921
pub const F_WRLCK: ::c_short = 2;
19271922
pub const F_UNLCK: ::c_short = 3;

0 commit comments

Comments
 (0)