@@ -22,6 +22,7 @@ use crate::fs::AtFlags;
2222 target_os = "nto" ,
2323 target_os = "redox" ,
2424 target_os = "vita" ,
25+ target_os = "vxworks" ,
2526) ) ) ]
2627use crate :: fs:: FallocateFlags ;
2728#[ cfg( not( any(
@@ -60,7 +61,7 @@ use crate::fs::Timestamps;
6061) ) ) ]
6162use crate :: fs:: { Dev , FileType } ;
6263use crate :: fs:: { Mode , OFlags , SeekFrom , Stat } ;
63- #[ cfg( not( target_os = "wasi" ) ) ]
64+ #[ cfg( not( any ( target_os = "wasi" , target_os = "vxworks" ) ) ) ]
6465use crate :: fs:: { StatVfs , StatVfsMountFlags } ;
6566use crate :: io;
6667#[ cfg( all( target_env = "gnu" , fix_y2038) ) ]
8586 target_os = "redox" ,
8687 target_os = "solaris" ,
8788 target_os = "vita" ,
89+ target_os = "vxworks" ,
8890) ) ) ]
8991use { crate :: fs:: Advice , core:: num:: NonZeroU64 } ;
9092#[ cfg( any( apple, linux_kernel, target_os = "hurd" ) ) ]
@@ -103,7 +105,7 @@ weak!(fn __futimens64(c::c_int, *const LibcTimespec) -> c::c_int);
103105/// Use a direct syscall (via libc) for `open`.
104106///
105107/// This is only currently necessary as a workaround for old glibc; see below.
106- #[ cfg( all( unix, target_env = "gnu" ) ) ]
108+ #[ cfg( all( not ( target_os = "vxworks" ) , unix, target_env = "gnu" ) ) ]
107109fn open_via_syscall ( path : & CStr , oflags : OFlags , mode : Mode ) -> io:: Result < OwnedFd > {
108110 // Linux on aarch64, loongarch64 and riscv64 has no `open` syscall so use
109111 // `openat`.
@@ -150,7 +152,8 @@ pub(crate) fn open(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result<OwnedF
150152 unix,
151153 target_env = "gnu" ,
152154 not( target_os = "hurd" ) ,
153- not( target_os = "freebsd" )
155+ not( target_os = "freebsd" ) ,
156+ not( target_os = "vxworks" ) ,
154157 ) ) ]
155158 if oflags. contains ( OFlags :: TMPFILE ) && crate :: backend:: if_glibc_is_less_than_2_25 ( ) {
156159 return open_via_syscall ( path, oflags, mode) ;
@@ -218,7 +221,8 @@ pub(crate) fn openat(
218221 unix,
219222 target_env = "gnu" ,
220223 not( target_os = "hurd" ) ,
221- not( target_os = "freebsd" )
224+ not( target_os = "freebsd" ) ,
225+ not( target_os = "vxworks" )
222226 ) ) ]
223227 if oflags. contains ( OFlags :: TMPFILE ) && crate :: backend:: if_glibc_is_less_than_2_25 ( ) {
224228 return openat_via_syscall ( dirfd, path, oflags, mode) ;
@@ -271,7 +275,7 @@ pub(crate) fn statfs(filename: &CStr) -> io::Result<StatFs> {
271275 }
272276}
273277
274- #[ cfg( not( target_os = "wasi" ) ) ]
278+ #[ cfg( not( any ( target_os = "wasi" , target_os = "vxworks" ) ) ) ]
275279#[ inline]
276280pub ( crate ) fn statvfs ( filename : & CStr ) -> io:: Result < StatVfs > {
277281 unsafe {
@@ -448,6 +452,7 @@ pub(crate) fn rename(old_path: &CStr, new_path: &CStr) -> io::Result<()> {
448452 unsafe { ret ( c:: rename ( c_str ( old_path) , c_str ( new_path) ) ) }
449453}
450454
455+ #[ cfg( not( target_os = "vxworks" ) ) ]
451456pub ( crate ) fn renameat (
452457 old_dirfd : BorrowedFd < ' _ > ,
453458 old_path : & CStr ,
@@ -481,7 +486,7 @@ pub(crate) fn renameat(
481486 ret ( c:: rename ( c_str ( old_path) , c_str ( new_path) ) )
482487 }
483488
484- #[ cfg( not( target_os = "macos" ) ) ]
489+ #[ cfg( not( any ( target_os = "macos" , target_os = "vxworks" ) ) ) ]
485490 unsafe {
486491 ret ( c:: renameat (
487492 borrowed_fd ( old_dirfd) ,
@@ -729,7 +734,7 @@ pub(crate) fn lstat(path: &CStr) -> io::Result<Stat> {
729734 }
730735}
731736
732- #[ cfg( not( any( target_os = "espidf" , target_os = "redox" ) ) ) ]
737+ #[ cfg( not( any( target_os = "espidf" , target_os = "redox" , target_os = "vxworks" ) ) ) ]
733738pub ( crate ) fn statat ( dirfd : BorrowedFd < ' _ > , path : & CStr , flags : AtFlags ) -> io:: Result < Stat > {
734739 // See the comments in `fstat` about using `crate::fs::statx` here.
735740 #[ cfg( all(
@@ -812,7 +817,8 @@ pub(crate) fn access(path: &CStr, access: Access) -> io::Result<()> {
812817 target_os = "espidf" ,
813818 target_os = "horizon" ,
814819 target_os = "redox" ,
815- target_os = "vita"
820+ target_os = "vita" ,
821+ target_os = "vxworks" ,
816822) ) ) ]
817823pub ( crate ) fn accessat (
818824 dirfd : BorrowedFd < ' _ > ,
@@ -1096,7 +1102,8 @@ pub(crate) fn chmod(path: &CStr, mode: Mode) -> io::Result<()> {
10961102 linux_kernel,
10971103 target_os = "espidf" ,
10981104 target_os = "redox" ,
1099- target_os = "wasi"
1105+ target_os = "wasi" ,
1106+ target_os = "vxworks" ,
11001107) ) ) ]
11011108pub ( crate ) fn chmodat (
11021109 dirfd : BorrowedFd < ' _ > ,
@@ -1175,7 +1182,7 @@ pub(crate) fn fclonefileat(
11751182 }
11761183}
11771184
1178- #[ cfg( not( any( target_os = "espidf" , target_os = "redox" , target_os = "wasi" ) ) ) ]
1185+ #[ cfg( not( any( target_os = "espidf" , target_os = "redox" , target_os = "wasi" , target_os = "vxworks" ) ) ) ]
11791186pub ( crate ) fn chownat (
11801187 dirfd : BorrowedFd < ' _ > ,
11811188 path : & CStr ,
@@ -1201,7 +1208,8 @@ pub(crate) fn chownat(
12011208 target_os = "horizon" ,
12021209 target_os = "redox" ,
12031210 target_os = "vita" ,
1204- target_os = "wasi"
1211+ target_os = "wasi" ,
1212+ target_os = "vxworks" ,
12051213) ) ) ]
12061214pub ( crate ) fn mknodat (
12071215 dirfd : BorrowedFd < ' _ > ,
@@ -1283,6 +1291,7 @@ pub(crate) fn copy_file_range(
12831291 target_os = "redox" ,
12841292 target_os = "solaris" ,
12851293 target_os = "vita" ,
1294+ target_os = "vxworks" ,
12861295) ) ) ]
12871296pub ( crate ) fn fadvise (
12881297 fd : BorrowedFd < ' _ > ,
@@ -1494,7 +1503,8 @@ pub(crate) fn fchown(fd: BorrowedFd<'_>, owner: Option<Uid>, group: Option<Gid>)
14941503 target_os = "horizon" ,
14951504 target_os = "solaris" ,
14961505 target_os = "vita" ,
1497- target_os = "wasi"
1506+ target_os = "wasi" ,
1507+ target_os = "vxworks" ,
14981508) ) ) ]
14991509pub ( crate ) fn flock ( fd : BorrowedFd < ' _ > , operation : FlockOperation ) -> io:: Result < ( ) > {
15001510 unsafe { ret ( c:: flock ( borrowed_fd ( fd) , operation as c:: c_int ) ) }
@@ -1522,7 +1532,8 @@ pub(crate) fn syncfs(fd: BorrowedFd<'_>) -> io::Result<()> {
15221532 target_os = "horizon" ,
15231533 target_os = "redox" ,
15241534 target_os = "vita" ,
1525- target_os = "wasi"
1535+ target_os = "wasi" ,
1536+ target_os = "vxworks" ,
15261537) ) ) ]
15271538pub ( crate ) fn sync ( ) {
15281539 unsafe { c:: sync ( ) }
@@ -1609,7 +1620,7 @@ pub(crate) fn fstatfs(fd: BorrowedFd<'_>) -> io::Result<StatFs> {
16091620 }
16101621}
16111622
1612- #[ cfg( not( target_os = "wasi" ) ) ]
1623+ #[ cfg( not( any ( target_os = "wasi" , target_os = "vxworks" ) ) ) ]
16131624pub ( crate ) fn fstatvfs ( fd : BorrowedFd < ' _ > ) -> io:: Result < StatVfs > {
16141625 let mut statvfs = MaybeUninit :: < c:: statvfs > :: uninit ( ) ;
16151626 unsafe {
@@ -1618,7 +1629,7 @@ pub(crate) fn fstatvfs(fd: BorrowedFd<'_>) -> io::Result<StatVfs> {
16181629 }
16191630}
16201631
1621- #[ cfg( not( target_os = "wasi" ) ) ]
1632+ #[ cfg( not( any ( target_os = "wasi" , target_os = "vxworks" ) ) ) ]
16221633fn libc_statvfs_to_statvfs ( from : c:: statvfs ) -> StatVfs {
16231634 StatVfs {
16241635 f_bsize : from. f_bsize as u64 ,
@@ -1744,6 +1755,7 @@ fn futimens_old(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> {
17441755 target_os = "nto" ,
17451756 target_os = "redox" ,
17461757 target_os = "vita" ,
1758+ target_os = "vxworks" ,
17471759) ) ) ]
17481760pub ( crate ) fn fallocate (
17491761 fd : BorrowedFd < ' _ > ,
0 commit comments