Skip to content

Commit

Permalink
Auto merge of #3310 - inferiorhumanorgans:solaris-no-flock, r=JohnTitor
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Aug 20, 2023
2 parents 9447d17 + 076f240 commit 65b16b3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,11 @@ extern "C" {
)]
pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char;

pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
cfg_if! {
if #[cfg(not(target_os = "solaris"))] {
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
}
}

#[cfg_attr(target_os = "netbsd", link_name = "__times13")]
pub fn times(buf: *mut ::tms) -> ::clock_t;
Expand Down
5 changes: 5 additions & 0 deletions src/unix/solarish/illumos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ pub const TCP_KEEPCNT: ::c_int = 35;
pub const TCP_KEEPINTVL: ::c_int = 36;
pub const TCP_CONGESTION: ::c_int = 37;

pub const LOCK_SH: ::c_int = 1;
pub const LOCK_EX: ::c_int = 2;
pub const LOCK_NB: ::c_int = 4;
pub const LOCK_UN: ::c_int = 8;

// These constants are correct for 64-bit programs or 32-bit programs that are
// not using large-file mode. If Rust ever supports anything other than 64-bit
// compilation on illumos, this may require adjustment:
Expand Down
5 changes: 0 additions & 5 deletions src/unix/solarish/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1917,11 +1917,6 @@ pub const SHUT_RD: ::c_int = 0;
pub const SHUT_WR: ::c_int = 1;
pub const SHUT_RDWR: ::c_int = 2;

pub const LOCK_SH: ::c_int = 1;
pub const LOCK_EX: ::c_int = 2;
pub const LOCK_NB: ::c_int = 4;
pub const LOCK_UN: ::c_int = 8;

pub const F_RDLCK: ::c_short = 1;
pub const F_WRLCK: ::c_short = 2;
pub const F_UNLCK: ::c_short = 3;
Expand Down

0 comments on commit 65b16b3

Please sign in to comment.