@@ -1254,64 +1254,54 @@ impl File {
12541254 }
12551255 }
12561256
1257- #[ cfg( not( any(
1258- target_os = "android" ,
1259- target_os = "emscripten" ,
1260- target_os = "fuchsia" ,
1261- target_os = "illumos" ,
1262- target_os = "redox" ,
1263- target_os = "solaris"
1264- ) ) ) ]
1257+ #[ cfg( any(
1258+ target_os = "freebsd" ,
1259+ target_os = "linux" ,
1260+ target_os = "netbsd" ,
1261+ target_vendor = "apple" ,
1262+ ) ) ]
12651263 pub fn lock ( & self ) -> io:: Result < ( ) > {
12661264 cvt ( unsafe { libc:: flock ( self . as_raw_fd ( ) , libc:: LOCK_EX ) } ) ?;
12671265 return Ok ( ( ) ) ;
12681266 }
12691267
1270- #[ cfg( any(
1271- target_os = "android" ,
1272- target_os = "emscripten" ,
1273- target_os = "fuchsia" ,
1274- target_os = "illumos" ,
1275- target_os = "redox" ,
1276- target_os = "solaris"
1277- ) ) ]
1268+ #[ cfg( not( any(
1269+ target_os = "freebsd" ,
1270+ target_os = "linux" ,
1271+ target_os = "netbsd" ,
1272+ target_vendor = "apple" ,
1273+ ) ) ) ]
12781274 pub fn lock ( & self ) -> io:: Result < ( ) > {
12791275 Err ( io:: const_io_error!( io:: ErrorKind :: Unsupported , "lock() not supported" ) )
12801276 }
12811277
1282- #[ cfg( not( any(
1283- target_os = "android" ,
1284- target_os = "emscripten" ,
1285- target_os = "fuchsia" ,
1286- target_os = "illumos" ,
1287- target_os = "redox" ,
1288- target_os = "solaris"
1289- ) ) ) ]
1278+ #[ cfg( any(
1279+ target_os = "freebsd" ,
1280+ target_os = "linux" ,
1281+ target_os = "netbsd" ,
1282+ target_vendor = "apple" ,
1283+ ) ) ]
12901284 pub fn lock_shared ( & self ) -> io:: Result < ( ) > {
12911285 cvt ( unsafe { libc:: flock ( self . as_raw_fd ( ) , libc:: LOCK_SH ) } ) ?;
12921286 return Ok ( ( ) ) ;
12931287 }
12941288
1295- #[ cfg( any(
1296- target_os = "android" ,
1297- target_os = "emscripten" ,
1298- target_os = "fuchsia" ,
1299- target_os = "illumos" ,
1300- target_os = "redox" ,
1301- target_os = "solaris"
1302- ) ) ]
1289+ #[ cfg( not( any(
1290+ target_os = "freebsd" ,
1291+ target_os = "linux" ,
1292+ target_os = "netbsd" ,
1293+ target_vendor = "apple" ,
1294+ ) ) ) ]
13031295 pub fn lock_shared ( & self ) -> io:: Result < ( ) > {
13041296 Err ( io:: const_io_error!( io:: ErrorKind :: Unsupported , "lock_shared() not supported" ) )
13051297 }
13061298
1307- #[ cfg( not( any(
1308- target_os = "android" ,
1309- target_os = "emscripten" ,
1310- target_os = "fuchsia" ,
1311- target_os = "illumos" ,
1312- target_os = "redox" ,
1313- target_os = "solaris"
1314- ) ) ) ]
1299+ #[ cfg( any(
1300+ target_os = "freebsd" ,
1301+ target_os = "linux" ,
1302+ target_os = "netbsd" ,
1303+ target_vendor = "apple" ,
1304+ ) ) ]
13151305 pub fn try_lock ( & self ) -> io:: Result < bool > {
13161306 let result = cvt ( unsafe { libc:: flock ( self . as_raw_fd ( ) , libc:: LOCK_EX | libc:: LOCK_NB ) } ) ;
13171307 if let Err ( ref err) = result {
@@ -1323,26 +1313,22 @@ impl File {
13231313 return Ok ( true ) ;
13241314 }
13251315
1326- #[ cfg( any(
1327- target_os = "android" ,
1328- target_os = "emscripten" ,
1329- target_os = "fuchsia" ,
1330- target_os = "illumos" ,
1331- target_os = "redox" ,
1332- target_os = "solaris"
1333- ) ) ]
1316+ #[ cfg( not( any(
1317+ target_os = "freebsd" ,
1318+ target_os = "linux" ,
1319+ target_os = "netbsd" ,
1320+ target_vendor = "apple" ,
1321+ ) ) ) ]
13341322 pub fn try_lock ( & self ) -> io:: Result < bool > {
13351323 Err ( io:: const_io_error!( io:: ErrorKind :: Unsupported , "try_lock() not supported" ) )
13361324 }
13371325
1338- #[ cfg( not( any(
1339- target_os = "android" ,
1340- target_os = "emscripten" ,
1341- target_os = "fuchsia" ,
1342- target_os = "illumos" ,
1343- target_os = "redox" ,
1344- target_os = "solaris"
1345- ) ) ) ]
1326+ #[ cfg( any(
1327+ target_os = "freebsd" ,
1328+ target_os = "linux" ,
1329+ target_os = "netbsd" ,
1330+ target_vendor = "apple" ,
1331+ ) ) ]
13461332 pub fn try_lock_shared ( & self ) -> io:: Result < bool > {
13471333 let result = cvt ( unsafe { libc:: flock ( self . as_raw_fd ( ) , libc:: LOCK_SH | libc:: LOCK_NB ) } ) ;
13481334 if let Err ( ref err) = result {
@@ -1354,39 +1340,33 @@ impl File {
13541340 return Ok ( true ) ;
13551341 }
13561342
1357- #[ cfg( any(
1358- target_os = "android" ,
1359- target_os = "emscripten" ,
1360- target_os = "fuchsia" ,
1361- target_os = "illumos" ,
1362- target_os = "redox" ,
1363- target_os = "solaris"
1364- ) ) ]
1343+ #[ cfg( not( any(
1344+ target_os = "freebsd" ,
1345+ target_os = "linux" ,
1346+ target_os = "netbsd" ,
1347+ target_vendor = "apple" ,
1348+ ) ) ) ]
13651349 pub fn try_lock_shared ( & self ) -> io:: Result < bool > {
13661350 Err ( io:: const_io_error!( io:: ErrorKind :: Unsupported , "try_lock_shared() not supported" ) )
13671351 }
13681352
1369- #[ cfg( not( any(
1370- target_os = "android" ,
1371- target_os = "emscripten" ,
1372- target_os = "fuchsia" ,
1373- target_os = "illumos" ,
1374- target_os = "redox" ,
1375- target_os = "solaris"
1376- ) ) ) ]
1353+ #[ cfg( any(
1354+ target_os = "freebsd" ,
1355+ target_os = "linux" ,
1356+ target_os = "netbsd" ,
1357+ target_vendor = "apple" ,
1358+ ) ) ]
13771359 pub fn unlock ( & self ) -> io:: Result < ( ) > {
13781360 cvt ( unsafe { libc:: flock ( self . as_raw_fd ( ) , libc:: LOCK_UN ) } ) ?;
13791361 return Ok ( ( ) ) ;
13801362 }
13811363
1382- #[ cfg( any(
1383- target_os = "android" ,
1384- target_os = "emscripten" ,
1385- target_os = "fuchsia" ,
1386- target_os = "illumos" ,
1387- target_os = "redox" ,
1388- target_os = "solaris"
1389- ) ) ]
1364+ #[ cfg( not( any(
1365+ target_os = "freebsd" ,
1366+ target_os = "linux" ,
1367+ target_os = "netbsd" ,
1368+ target_vendor = "apple" ,
1369+ ) ) ) ]
13901370 pub fn unlock ( & self ) -> io:: Result < ( ) > {
13911371 Err ( io:: const_io_error!( io:: ErrorKind :: Unsupported , "unlock() not supported" ) )
13921372 }
0 commit comments