@@ -499,12 +499,16 @@ pub enum FcntlArg<'a> {
499
499
F_GET_SEALS ,
500
500
#[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
501
501
F_FULLFSYNC ,
502
+ #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
503
+ F_BARRIERFSYNC ,
502
504
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
503
505
F_GETPIPE_SZ ,
504
506
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
505
507
F_SETPIPE_SZ ( c_int) ,
506
508
#[ cfg( any( target_os = "netbsd" , target_os = "dragonfly" , target_os = "macos" , target_os = "ios" ) ) ]
507
509
F_GETPATH ( & ' a mut PathBuf ) ,
510
+ #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
511
+ F_GETPATH_NOFIRMLINK ( & ' a mut PathBuf ) ,
508
512
// TODO: Rest of flags
509
513
}
510
514
@@ -561,6 +565,8 @@ pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
561
565
F_GET_SEALS => libc:: fcntl( fd, libc:: F_GET_SEALS ) ,
562
566
#[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
563
567
F_FULLFSYNC => libc:: fcntl( fd, libc:: F_FULLFSYNC ) ,
568
+ #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
569
+ F_BARRIERFSYNC => libc:: fcntl( fd, libc:: F_BARRIERFSYNC ) ,
564
570
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
565
571
F_GETPIPE_SZ => libc:: fcntl( fd, libc:: F_GETPIPE_SZ ) ,
566
572
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
@@ -574,6 +580,15 @@ pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
574
580
* path = PathBuf :: from( OsString :: from( optr. to_str( ) . unwrap( ) ) ) ;
575
581
return Ok ( ok_res)
576
582
} ,
583
+ #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
584
+ F_GETPATH_NOFIRMLINK ( path) => {
585
+ let mut buffer = vec![ 0 ; libc:: PATH_MAX as usize ] ;
586
+ let res = libc:: fcntl( fd, libc:: F_GETPATH_NOFIRMLINK , buffer. as_mut_ptr( ) ) ;
587
+ let ok_res = Errno :: result( res) ?;
588
+ let optr = CStr :: from_bytes_until_nul( & buffer) . unwrap( ) ;
589
+ * path = PathBuf :: from( OsString :: from( optr. to_str( ) . unwrap( ) ) ) ;
590
+ return Ok ( ok_res)
591
+ } ,
577
592
}
578
593
} ;
579
594
0 commit comments