@@ -9,9 +9,9 @@ use crate::backend::c;
9
9
use crate :: backend:: conv:: ret_usize;
10
10
use crate :: backend:: conv:: { borrowed_fd, c_str, ret, ret_c_int, ret_off_t, ret_owned_fd} ;
11
11
use crate :: fd:: { BorrowedFd , OwnedFd } ;
12
- use crate :: ffi:: CStr ;
13
12
#[ cfg( all( apple, feature = "alloc" ) ) ]
14
13
use crate :: ffi:: CString ;
14
+ use crate :: ffi:: { self , CStr } ;
15
15
#[ cfg( not( any( target_os = "espidf" , target_os = "vita" ) ) ) ]
16
16
use crate :: fs:: Access ;
17
17
#[ cfg( not( any(
89
89
} ;
90
90
91
91
#[ cfg( all( target_env = "gnu" , fix_y2038) ) ]
92
- weak ! ( fn __utimensat64( c:: c_int, * const c :: c_char, * const LibcTimespec , c:: c_int) -> c:: c_int) ;
92
+ weak ! ( fn __utimensat64( c:: c_int, * const ffi :: c_char, * const LibcTimespec , c:: c_int) -> c:: c_int) ;
93
93
#[ cfg( all( target_env = "gnu" , fix_y2038) ) ]
94
94
weak ! ( fn __futimens64( c:: c_int, * const LibcTimespec ) -> c:: c_int) ;
95
95
@@ -122,7 +122,7 @@ fn open_via_syscall(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result<Owned
122
122
unsafe {
123
123
syscall ! {
124
124
fn open(
125
- pathname: * const c :: c_char,
125
+ pathname: * const ffi :: c_char,
126
126
oflags: c:: c_int,
127
127
mode: c:: mode_t
128
128
) via SYS_open -> c:: c_int
@@ -182,7 +182,7 @@ fn openat_via_syscall(
182
182
syscall ! {
183
183
fn openat(
184
184
base_dirfd: c:: c_int,
185
- pathname: * const c :: c_char,
185
+ pathname: * const ffi :: c_char,
186
186
oflags: c:: c_int,
187
187
mode: c:: mode_t
188
188
) via SYS_openat -> c:: c_int
@@ -277,9 +277,11 @@ pub(crate) fn statvfs(filename: &CStr) -> io::Result<StatVfs> {
277
277
#[ inline]
278
278
pub ( crate ) fn readlink ( path : & CStr , buf : & mut [ u8 ] ) -> io:: Result < usize > {
279
279
unsafe {
280
- ret_usize (
281
- c:: readlink ( c_str ( path) , buf. as_mut_ptr ( ) . cast :: < c:: c_char > ( ) , buf. len ( ) ) as isize ,
282
- )
280
+ ret_usize ( c:: readlink (
281
+ c_str ( path) ,
282
+ buf. as_mut_ptr ( ) . cast :: < ffi:: c_char > ( ) ,
283
+ buf. len ( ) ,
284
+ ) as isize )
283
285
}
284
286
}
285
287
@@ -294,7 +296,7 @@ pub(crate) fn readlinkat(
294
296
ret_usize ( c:: readlinkat (
295
297
borrowed_fd ( dirfd) ,
296
298
c_str ( path) ,
297
- buf. as_mut_ptr ( ) . cast :: < c :: c_char > ( ) ,
299
+ buf. as_mut_ptr ( ) . cast :: < ffi :: c_char > ( ) ,
298
300
buf. len ( ) ,
299
301
) as isize )
300
302
}
@@ -354,9 +356,9 @@ pub(crate) fn linkat(
354
356
weak ! {
355
357
fn linkat(
356
358
c:: c_int,
357
- * const c :: c_char,
359
+ * const ffi :: c_char,
358
360
c:: c_int,
359
- * const c :: c_char,
361
+ * const ffi :: c_char,
360
362
c:: c_int
361
363
) -> c:: c_int
362
364
}
@@ -411,7 +413,7 @@ pub(crate) fn unlinkat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io
411
413
weak ! {
412
414
fn unlinkat(
413
415
c:: c_int,
414
- * const c :: c_char,
416
+ * const ffi :: c_char,
415
417
c:: c_int
416
418
) -> c:: c_int
417
419
}
@@ -464,9 +466,9 @@ pub(crate) fn renameat(
464
466
weak ! {
465
467
fn renameat(
466
468
c:: c_int,
467
- * const c :: c_char,
469
+ * const ffi :: c_char,
468
470
c:: c_int,
469
- * const c :: c_char
471
+ * const ffi :: c_char
470
472
) -> c:: c_int
471
473
}
472
474
// If we have `renameat`, use it.
@@ -508,9 +510,9 @@ pub(crate) fn renameat2(
508
510
weak_or_syscall ! {
509
511
fn renameat2(
510
512
olddirfd: c:: c_int,
511
- oldpath: * const c :: c_char,
513
+ oldpath: * const ffi :: c_char,
512
514
newdirfd: c:: c_int,
513
- newpath: * const c :: c_char,
515
+ newpath: * const ffi :: c_char,
514
516
flags: c:: c_uint
515
517
) via SYS_renameat2 -> c:: c_int
516
518
}
@@ -547,9 +549,9 @@ pub(crate) fn renameat2(
547
549
syscall ! {
548
550
fn renameat2(
549
551
olddirfd: c:: c_int,
550
- oldpath: * const c :: c_char,
552
+ oldpath: * const ffi :: c_char,
551
553
newdirfd: c:: c_int,
552
- newpath: * const c :: c_char,
554
+ newpath: * const ffi :: c_char,
553
555
flags: c:: c_uint
554
556
) via SYS_renameat2 -> c:: c_int
555
557
}
@@ -750,7 +752,7 @@ pub(crate) fn accessat(
750
752
weak ! {
751
753
fn faccessat(
752
754
c:: c_int,
753
- * const c :: c_char,
755
+ * const ffi :: c_char,
754
756
c:: c_int,
755
757
c:: c_int
756
758
) -> c:: c_int
@@ -857,14 +859,14 @@ pub(crate) fn utimensat(
857
859
weak ! {
858
860
fn utimensat(
859
861
c:: c_int,
860
- * const c :: c_char,
862
+ * const ffi :: c_char,
861
863
* const c:: timespec,
862
864
c:: c_int
863
865
) -> c:: c_int
864
866
}
865
867
extern "C" {
866
868
fn setattrlist (
867
- path : * const c :: c_char ,
869
+ path : * const ffi :: c_char ,
868
870
attr_list : * const Attrlist ,
869
871
attr_buf : * const c:: c_void ,
870
872
attr_buf_size : c:: size_t ,
@@ -1051,7 +1053,7 @@ pub(crate) fn chmodat(
1051
1053
syscall ! {
1052
1054
fn fchmodat(
1053
1055
base_dirfd: c:: c_int,
1054
- pathname: * const c :: c_char,
1056
+ pathname: * const ffi :: c_char,
1055
1057
mode: c:: mode_t
1056
1058
) via SYS_fchmodat -> c:: c_int
1057
1059
}
@@ -1081,7 +1083,7 @@ pub(crate) fn fclonefileat(
1081
1083
fn fclonefileat(
1082
1084
srcfd: BorrowedFd <' _>,
1083
1085
dst_dirfd: BorrowedFd <' _>,
1084
- dst: * const c :: c_char,
1086
+ dst: * const ffi :: c_char,
1085
1087
flags: c:: c_int
1086
1088
) via SYS_fclonefileat -> c:: c_int
1087
1089
}
@@ -1713,15 +1715,15 @@ pub(crate) fn memfd_create(name: &CStr, flags: MemfdFlags) -> io::Result<OwnedFd
1713
1715
#[ cfg( target_os = "freebsd" ) ]
1714
1716
weakcall ! {
1715
1717
fn memfd_create(
1716
- name: * const c :: c_char,
1718
+ name: * const ffi :: c_char,
1717
1719
flags: c:: c_uint
1718
1720
) -> c:: c_int
1719
1721
}
1720
1722
1721
1723
#[ cfg( linux_kernel) ]
1722
1724
weak_or_syscall ! {
1723
1725
fn memfd_create(
1724
- name: * const c :: c_char,
1726
+ name: * const ffi :: c_char,
1725
1727
flags: c:: c_uint
1726
1728
) via SYS_memfd_create -> c:: c_int
1727
1729
}
@@ -1742,7 +1744,7 @@ pub(crate) fn openat2(
1742
1744
syscall ! {
1743
1745
fn openat2(
1744
1746
base_dirfd: c:: c_int,
1745
- pathname: * const c :: c_char,
1747
+ pathname: * const ffi :: c_char,
1746
1748
how: * mut open_how,
1747
1749
size: usize
1748
1750
) via SYS_OPENAT2 -> c:: c_int
@@ -1910,12 +1912,12 @@ fn stat64_to_stat(s64: c::stat64) -> io::Result<Stat> {
1910
1912
#[ cfg( linux_kernel) ]
1911
1913
#[ allow( non_upper_case_globals) ]
1912
1914
mod sys {
1913
- use super :: { c, BorrowedFd , Statx } ;
1915
+ use super :: { c, ffi , BorrowedFd , Statx } ;
1914
1916
1915
1917
weak_or_syscall ! {
1916
1918
pub ( super ) fn statx(
1917
1919
dirfd_: BorrowedFd <' _>,
1918
- path: * const c :: c_char,
1920
+ path: * const ffi :: c_char,
1919
1921
flags: c:: c_int,
1920
1922
mask: c:: c_uint,
1921
1923
buf: * mut Statx
@@ -2442,7 +2444,7 @@ pub(crate) fn fsetxattr(
2442
2444
}
2443
2445
2444
2446
#[ cfg( any( apple, linux_kernel, target_os = "hurd" ) ) ]
2445
- pub ( crate ) fn listxattr ( path : & CStr , list : & mut [ c :: c_char ] ) -> io:: Result < usize > {
2447
+ pub ( crate ) fn listxattr ( path : & CStr , list : & mut [ ffi :: c_char ] ) -> io:: Result < usize > {
2446
2448
#[ cfg( not( apple) ) ]
2447
2449
unsafe {
2448
2450
ret_usize ( c:: listxattr ( path. as_ptr ( ) , list. as_mut_ptr ( ) , list. len ( ) ) )
@@ -2460,7 +2462,7 @@ pub(crate) fn listxattr(path: &CStr, list: &mut [c::c_char]) -> io::Result<usize
2460
2462
}
2461
2463
2462
2464
#[ cfg( any( apple, linux_kernel, target_os = "hurd" ) ) ]
2463
- pub ( crate ) fn llistxattr ( path : & CStr , list : & mut [ c :: c_char ] ) -> io:: Result < usize > {
2465
+ pub ( crate ) fn llistxattr ( path : & CStr , list : & mut [ ffi :: c_char ] ) -> io:: Result < usize > {
2464
2466
#[ cfg( not( apple) ) ]
2465
2467
unsafe {
2466
2468
ret_usize ( c:: llistxattr ( path. as_ptr ( ) , list. as_mut_ptr ( ) , list. len ( ) ) )
@@ -2478,7 +2480,7 @@ pub(crate) fn llistxattr(path: &CStr, list: &mut [c::c_char]) -> io::Result<usiz
2478
2480
}
2479
2481
2480
2482
#[ cfg( any( apple, linux_kernel, target_os = "hurd" ) ) ]
2481
- pub ( crate ) fn flistxattr ( fd : BorrowedFd < ' _ > , list : & mut [ c :: c_char ] ) -> io:: Result < usize > {
2483
+ pub ( crate ) fn flistxattr ( fd : BorrowedFd < ' _ > , list : & mut [ ffi :: c_char ] ) -> io:: Result < usize > {
2482
2484
let fd = borrowed_fd ( fd) ;
2483
2485
2484
2486
#[ cfg( not( apple) ) ]
0 commit comments