@@ -949,27 +949,49 @@ bitflags! {
949949///
950950/// [`flock`]: crate::fs::flock
951951/// [`fcntl_lock`]: crate::fs::fcntl_lock
952- #[ cfg( not( any(
953- target_os = "espidf" ,
954- target_os = "solaris" ,
955- target_os = "vita" ,
956- target_os = "wasi"
957- ) ) ) ]
952+ // Solaris doesn't support `flock` and doesn't define `LOCK_SH` etc., but we
953+ // reuse this `FlockOperation` enum for `fcntl_lock`, so on Solaris we use
954+ // our own made-up integer values.
955+ #[ cfg( not( any( target_os = "espidf" , target_os = "vita" , target_os = "wasi" ) ) ) ]
958956#[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
959957#[ repr( u32 ) ]
960958pub enum FlockOperation {
961959 /// `LOCK_SH`
960+ #[ cfg( not( target_os = "solaris" ) ) ]
962961 LockShared = bitcast ! ( c:: LOCK_SH ) ,
962+ /// `LOCK_SH`
963+ #[ cfg( target_os = "solaris" ) ]
964+ LockShared = bitcast ! ( 1 ) ,
963965 /// `LOCK_EX`
966+ #[ cfg( not( target_os = "solaris" ) ) ]
964967 LockExclusive = bitcast ! ( c:: LOCK_EX ) ,
968+ /// `LOCK_EX`
969+ #[ cfg( target_os = "solaris" ) ]
970+ LockExclusive = bitcast ! ( 2 ) ,
965971 /// `LOCK_UN`
972+ #[ cfg( not( target_os = "solaris" ) ) ]
966973 Unlock = bitcast ! ( c:: LOCK_UN ) ,
974+ /// `LOCK_UN`
975+ #[ cfg( target_os = "solaris" ) ]
976+ Unlock = bitcast ! ( 8 ) ,
967977 /// `LOCK_SH | LOCK_NB`
978+ #[ cfg( not( target_os = "solaris" ) ) ]
968979 NonBlockingLockShared = bitcast ! ( c:: LOCK_SH | c:: LOCK_NB ) ,
980+ /// `LOCK_SH | LOCK_NB`
981+ #[ cfg( target_os = "solaris" ) ]
982+ NonBlockingLockShared = bitcast ! ( 1 | 4 ) ,
969983 /// `LOCK_EX | LOCK_NB`
984+ #[ cfg( not( target_os = "solaris" ) ) ]
970985 NonBlockingLockExclusive = bitcast ! ( c:: LOCK_EX | c:: LOCK_NB ) ,
986+ /// `LOCK_EX | LOCK_NB`
987+ #[ cfg( target_os = "solaris" ) ]
988+ NonBlockingLockExclusive = bitcast ! ( 2 | 4 ) ,
971989 /// `LOCK_UN | LOCK_NB`
990+ #[ cfg( not( target_os = "solaris" ) ) ]
972991 NonBlockingUnlock = bitcast ! ( c:: LOCK_UN | c:: LOCK_NB ) ,
992+ /// `LOCK_UN | LOCK_NB`
993+ #[ cfg( target_os = "solaris" ) ]
994+ NonBlockingUnlock = bitcast ! ( 8 | 4 ) ,
973995}
974996
975997/// `struct stat` for use with [`statat`] and [`fstat`].
0 commit comments