@@ -15,6 +15,7 @@ use crate::mem;
15
15
target_os = "redox" ,
16
16
target_os = "illumos" ,
17
17
target_os = "nto" ,
18
+ target_os = "vita" ,
18
19
) ) ]
19
20
use crate :: mem:: MaybeUninit ;
20
21
use crate :: os:: unix:: io:: { AsFd , AsRawFd , BorrowedFd , FromRawFd , IntoRawFd } ;
@@ -58,6 +59,7 @@ use libc::fstatat64;
58
59
target_os = "redox" ,
59
60
target_os = "illumos" ,
60
61
target_os = "nto" ,
62
+ target_os = "vita" ,
61
63
) ) ]
62
64
use libc:: readdir as readdir64;
63
65
#[ cfg( target_os = "linux" ) ]
@@ -74,6 +76,7 @@ use libc::readdir64_r;
74
76
target_os = "fuchsia" ,
75
77
target_os = "redox" ,
76
78
target_os = "nto" ,
79
+ target_os = "vita" ,
77
80
) ) ) ]
78
81
use libc:: readdir_r as readdir64_r;
79
82
#[ cfg( target_os = "android" ) ]
@@ -283,6 +286,7 @@ unsafe impl Sync for Dir {}
283
286
target_os = "fuchsia" ,
284
287
target_os = "redox" ,
285
288
target_os = "nto" ,
289
+ target_os = "vita"
286
290
) ) ]
287
291
pub struct DirEntry {
288
292
dir : Arc < InnerReadDir > ,
@@ -304,10 +308,16 @@ pub struct DirEntry {
304
308
target_os = "fuchsia" ,
305
309
target_os = "redox" ,
306
310
target_os = "nto" ,
311
+ target_os = "vita" ,
307
312
) ) ]
308
313
struct dirent64_min {
309
314
d_ino : u64 ,
310
- #[ cfg( not( any( target_os = "solaris" , target_os = "illumos" , target_os = "nto" ) ) ) ]
315
+ #[ cfg( not( any(
316
+ target_os = "solaris" ,
317
+ target_os = "illumos" ,
318
+ target_os = "nto" ,
319
+ target_os = "vita"
320
+ ) ) ) ]
311
321
d_type : u8 ,
312
322
}
313
323
@@ -319,6 +329,7 @@ struct dirent64_min {
319
329
target_os = "fuchsia" ,
320
330
target_os = "redox" ,
321
331
target_os = "nto" ,
332
+ target_os = "vita" ,
322
333
) ) ) ]
323
334
pub struct DirEntry {
324
335
dir : Arc < InnerReadDir > ,
@@ -520,6 +531,7 @@ impl FileAttr {
520
531
target_os = "macos" ,
521
532
target_os = "ios" ,
522
533
target_os = "watchos" ,
534
+ target_os = "vita" ,
523
535
) ) ) ]
524
536
pub fn created ( & self ) -> io:: Result < SystemTime > {
525
537
cfg_has_statx ! {
@@ -541,6 +553,11 @@ impl FileAttr {
541
553
currently",
542
554
) )
543
555
}
556
+
557
+ #[ cfg( target_os = "vita" ) ]
558
+ pub fn created ( & self ) -> io:: Result < SystemTime > {
559
+ Ok ( SystemTime :: new ( self . stat . st_ctime as i64 , 0 ) )
560
+ }
544
561
}
545
562
546
563
#[ cfg( target_os = "nto" ) ]
@@ -645,6 +662,7 @@ impl Iterator for ReadDir {
645
662
target_os = "redox" ,
646
663
target_os = "illumos" ,
647
664
target_os = "nto" ,
665
+ target_os = "vita" ,
648
666
) ) ]
649
667
fn next ( & mut self ) -> Option < io:: Result < DirEntry > > {
650
668
if self . end_of_stream {
@@ -725,6 +743,7 @@ impl Iterator for ReadDir {
725
743
continue ;
726
744
}
727
745
746
+ #[ cfg( not( target_os = "vita" ) ) ]
728
747
let entry = dirent64_min {
729
748
d_ino : * offset_ptr ! ( entry_ptr, d_ino) as u64 ,
730
749
#[ cfg( not( any(
@@ -735,6 +754,9 @@ impl Iterator for ReadDir {
735
754
d_type : * offset_ptr ! ( entry_ptr, d_type) as u8 ,
736
755
} ;
737
756
757
+ #[ cfg( target_os = "vita" ) ]
758
+ let entry = dirent64_min { d_ino : 0u64 } ;
759
+
738
760
return Some ( Ok ( DirEntry {
739
761
entry,
740
762
name : name. to_owned ( ) ,
@@ -752,6 +774,7 @@ impl Iterator for ReadDir {
752
774
target_os = "redox" ,
753
775
target_os = "illumos" ,
754
776
target_os = "nto" ,
777
+ target_os = "vita" ,
755
778
) ) ) ]
756
779
fn next ( & mut self ) -> Option < io:: Result < DirEntry > > {
757
780
if self . end_of_stream {
@@ -842,6 +865,7 @@ impl DirEntry {
842
865
target_os = "haiku" ,
843
866
target_os = "vxworks" ,
844
867
target_os = "nto" ,
868
+ target_os = "vita" ,
845
869
) ) ]
846
870
pub fn file_type ( & self ) -> io:: Result < FileType > {
847
871
self . metadata ( ) . map ( |m| m. file_type ( ) )
@@ -853,6 +877,7 @@ impl DirEntry {
853
877
target_os = "haiku" ,
854
878
target_os = "vxworks" ,
855
879
target_os = "nto" ,
880
+ target_os = "vita" ,
856
881
) ) ) ]
857
882
pub fn file_type ( & self ) -> io:: Result < FileType > {
858
883
match self . entry . d_type {
@@ -939,6 +964,7 @@ impl DirEntry {
939
964
target_os = "fuchsia" ,
940
965
target_os = "redox" ,
941
966
target_os = "nto" ,
967
+ target_os = "vita" ,
942
968
) ) ) ]
943
969
fn name_cstr ( & self ) -> & CStr {
944
970
unsafe { CStr :: from_ptr ( self . entry . d_name . as_ptr ( ) ) }
@@ -951,6 +977,7 @@ impl DirEntry {
951
977
target_os = "fuchsia" ,
952
978
target_os = "redox" ,
953
979
target_os = "nto" ,
980
+ target_os = "vita" ,
954
981
) ) ]
955
982
fn name_cstr ( & self ) -> & CStr {
956
983
& self . name
@@ -1543,7 +1570,7 @@ pub fn link(original: &Path, link: &Path) -> io::Result<()> {
1543
1570
run_path_with_cstr ( original, |original| {
1544
1571
run_path_with_cstr ( link, |link| {
1545
1572
cfg_if:: cfg_if! {
1546
- if #[ cfg( any( target_os = "vxworks" , target_os = "redox" , target_os = "android" , target_os = "espidf" , target_os = "horizon" ) ) ] {
1573
+ if #[ cfg( any( target_os = "vxworks" , target_os = "redox" , target_os = "android" , target_os = "espidf" , target_os = "horizon" , target_os = "vita" ) ) ] {
1547
1574
// VxWorks, Redox and ESP-IDF lack `linkat`, so use `link` instead. POSIX leaves
1548
1575
// it implementation-defined whether `link` follows symlinks, so rely on the
1549
1576
// `symlink_hard_link` test in library/std/src/fs/tests.rs to check the behavior.
@@ -1666,6 +1693,8 @@ fn open_to_and_set_permissions(
1666
1693
. truncate ( true )
1667
1694
. open ( to) ?;
1668
1695
let writer_metadata = writer. metadata ( ) ?;
1696
+ // fchmod is broken on vita
1697
+ #[ cfg( not( target_os = "vita" ) ) ]
1669
1698
if writer_metadata. is_file ( ) {
1670
1699
// Set the correct file permissions, in case the file already existed.
1671
1700
// Don't set the permissions on already existing non-files like
@@ -1844,11 +1873,12 @@ pub fn chroot(dir: &Path) -> io::Result<()> {
1844
1873
1845
1874
pub use remove_dir_impl:: remove_dir_all;
1846
1875
1847
- // Fallback for REDOX, ESP-ID, Horizon, and Miri
1876
+ // Fallback for REDOX, ESP-ID, Horizon, Vita and Miri
1848
1877
#[ cfg( any(
1849
1878
target_os = "redox" ,
1850
1879
target_os = "espidf" ,
1851
1880
target_os = "horizon" ,
1881
+ target_os = "vita" ,
1852
1882
target_os = "nto" ,
1853
1883
miri
1854
1884
) ) ]
@@ -1861,6 +1891,7 @@ mod remove_dir_impl {
1861
1891
target_os = "redox" ,
1862
1892
target_os = "espidf" ,
1863
1893
target_os = "horizon" ,
1894
+ target_os = "vita" ,
1864
1895
target_os = "nto" ,
1865
1896
miri
1866
1897
) ) ) ]
0 commit comments