1- use super :: abi :: {
1+ use super :: hermit_abi :: {
22 self , dirent64, stat as stat_struct, DT_DIR , DT_LNK , DT_REG , DT_UNKNOWN , O_APPEND , O_CREAT ,
33 O_EXCL , O_RDONLY , O_RDWR , O_TRUNC , O_WRONLY , S_IFDIR , S_IFLNK , S_IFMT , S_IFREG ,
44} ;
@@ -361,7 +361,7 @@ impl File {
361361 mode = 0 ;
362362 }
363363
364- let fd = unsafe { cvt ( abi :: open ( path. as_ptr ( ) , flags, mode) ) ? } ;
364+ let fd = unsafe { cvt ( hermit_abi :: open ( path. as_ptr ( ) , flags, mode) ) ? } ;
365365 Ok ( File ( unsafe { FileDesc :: from_raw_fd ( fd as i32 ) } ) )
366366 }
367367
@@ -442,7 +442,7 @@ impl DirBuilder {
442442
443443 pub fn mkdir ( & self , path : & Path ) -> io:: Result < ( ) > {
444444 run_path_with_cstr ( path, & |path| {
445- cvt ( unsafe { abi :: mkdir ( path. as_ptr ( ) , self . mode ) } ) . map ( |_| ( ) )
445+ cvt ( unsafe { hermit_abi :: mkdir ( path. as_ptr ( ) , self . mode ) } ) . map ( |_| ( ) )
446446 } )
447447 }
448448
@@ -504,7 +504,7 @@ impl FromRawFd for File {
504504}
505505
506506pub fn readdir ( path : & Path ) -> io:: Result < ReadDir > {
507- let fd_raw = run_path_with_cstr ( path, & |path| cvt ( unsafe { abi :: opendir ( path. as_ptr ( ) ) } ) ) ?;
507+ let fd_raw = run_path_with_cstr ( path, & |path| cvt ( unsafe { hermit_abi :: opendir ( path. as_ptr ( ) ) } ) ) ?;
508508 let fd = unsafe { FileDesc :: from_raw_fd ( fd_raw as i32 ) } ;
509509 let root = path. to_path_buf ( ) ;
510510
@@ -516,7 +516,7 @@ pub fn readdir(path: &Path) -> io::Result<ReadDir> {
516516 vec. resize ( sz, 0 ) ;
517517
518518 let readlen =
519- unsafe { abi :: getdents64 ( fd. as_raw_fd ( ) , vec. as_mut_ptr ( ) as * mut dirent64 , sz) } ;
519+ unsafe { hermit_abi :: getdents64 ( fd. as_raw_fd ( ) , vec. as_mut_ptr ( ) as * mut dirent64 , sz) } ;
520520 if readlen > 0 {
521521 // shrink down to the minimal size
522522 vec. resize ( readlen. try_into ( ) . unwrap ( ) , 0 ) ;
@@ -525,7 +525,7 @@ pub fn readdir(path: &Path) -> io::Result<ReadDir> {
525525
526526 // if the buffer is too small, getdents64 returns EINVAL
527527 // otherwise, getdents64 returns an error number
528- if readlen != ( -abi :: errno:: EINVAL ) . into ( ) {
528+ if readlen != ( -hermit_abi :: errno:: EINVAL ) . into ( ) {
529529 return Err ( Error :: from_raw_os_error ( readlen. try_into ( ) . unwrap ( ) ) ) ;
530530 }
531531
@@ -543,7 +543,7 @@ pub fn readdir(path: &Path) -> io::Result<ReadDir> {
543543}
544544
545545pub fn unlink ( path : & Path ) -> io:: Result < ( ) > {
546- run_path_with_cstr ( path, & |path| cvt ( unsafe { abi :: unlink ( path. as_ptr ( ) ) } ) . map ( |_| ( ) ) )
546+ run_path_with_cstr ( path, & |path| cvt ( unsafe { hermit_abi :: unlink ( path. as_ptr ( ) ) } ) . map ( |_| ( ) ) )
547547}
548548
549549pub fn rename ( _old : & Path , _new : & Path ) -> io:: Result < ( ) > {
@@ -555,7 +555,7 @@ pub fn set_perm(_p: &Path, _perm: FilePermissions) -> io::Result<()> {
555555}
556556
557557pub fn rmdir ( path : & Path ) -> io:: Result < ( ) > {
558- run_path_with_cstr ( path, & |path| cvt ( unsafe { abi :: rmdir ( path. as_ptr ( ) ) } ) . map ( |_| ( ) ) )
558+ run_path_with_cstr ( path, & |path| cvt ( unsafe { hermit_abi :: rmdir ( path. as_ptr ( ) ) } ) . map ( |_| ( ) ) )
559559}
560560
561561pub fn remove_dir_all ( _path : & Path ) -> io:: Result < ( ) > {
@@ -577,15 +577,15 @@ pub fn link(_original: &Path, _link: &Path) -> io::Result<()> {
577577pub fn stat ( path : & Path ) -> io:: Result < FileAttr > {
578578 run_path_with_cstr ( path, & |path| {
579579 let mut stat_val: stat_struct = unsafe { mem:: zeroed ( ) } ;
580- cvt ( unsafe { abi :: stat ( path. as_ptr ( ) , & mut stat_val) } ) ?;
580+ cvt ( unsafe { hermit_abi :: stat ( path. as_ptr ( ) , & mut stat_val) } ) ?;
581581 Ok ( FileAttr :: from_stat ( stat_val) )
582582 } )
583583}
584584
585585pub fn lstat ( path : & Path ) -> io:: Result < FileAttr > {
586586 run_path_with_cstr ( path, & |path| {
587587 let mut stat_val: stat_struct = unsafe { mem:: zeroed ( ) } ;
588- cvt ( unsafe { abi :: lstat ( path. as_ptr ( ) , & mut stat_val) } ) ?;
588+ cvt ( unsafe { hermit_abi :: lstat ( path. as_ptr ( ) , & mut stat_val) } ) ?;
589589 Ok ( FileAttr :: from_stat ( stat_val) )
590590 } )
591591}
0 commit comments