@@ -504,6 +504,8 @@ pub enum FcntlArg<'a> {
504504 F_GET_SEALS ,
505505 #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
506506 F_FULLFSYNC ,
507+ #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
508+ F_BARRIERFSYNC ,
507509 #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
508510 F_GETPIPE_SZ ,
509511 #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
@@ -512,6 +514,8 @@ pub enum FcntlArg<'a> {
512514 F_GETPATH ( & ' a mut PathBuf ) ,
513515 #[ cfg( all( target_os = "freebsd" , target_arch = "x86_64" ) ) ]
514516 F_KINFO ( & ' a mut PathBuf ) ,
517+ #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
518+ F_GETPATH_NOFIRMLINK ( & ' a mut PathBuf ) ,
515519 // TODO: Rest of flags
516520}
517521
@@ -568,6 +572,8 @@ pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
568572 F_GET_SEALS => libc:: fcntl( fd, libc:: F_GET_SEALS ) ,
569573 #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
570574 F_FULLFSYNC => libc:: fcntl( fd, libc:: F_FULLFSYNC ) ,
575+ #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
576+ F_BARRIERFSYNC => libc:: fcntl( fd, libc:: F_BARRIERFSYNC ) ,
571577 #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
572578 F_GETPIPE_SZ => libc:: fcntl( fd, libc:: F_GETPIPE_SZ ) ,
573579 #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
@@ -593,6 +599,15 @@ pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
593599 * path = PathBuf :: from( OsString :: from( optr. to_str( ) . unwrap( ) ) ) ;
594600 return Ok ( ok_res)
595601 } ,
602+ #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
603+ F_GETPATH_NOFIRMLINK ( path) => {
604+ let mut buffer = vec![ 0 ; libc:: PATH_MAX as usize ] ;
605+ let res = libc:: fcntl( fd, libc:: F_GETPATH_NOFIRMLINK , buffer. as_mut_ptr( ) ) ;
606+ let ok_res = Errno :: result( res) ?;
607+ let optr = CStr :: from_bytes_until_nul( & buffer) . unwrap( ) ;
608+ * path = PathBuf :: from( OsString :: from( optr. to_str( ) . unwrap( ) ) ) ;
609+ return Ok ( ok_res)
610+ } ,
596611 }
597612 } ;
598613
0 commit comments