@@ -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( apple) ]
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(
90
90
} ;
91
91
92
92
#[ cfg( all( target_env = "gnu" , fix_y2038) ) ]
93
- weak ! ( fn __utimensat64( c:: c_int, * const c :: c_char, * const LibcTimespec , c:: c_int) -> c:: c_int) ;
93
+ weak ! ( fn __utimensat64( c:: c_int, * const ffi :: c_char, * const LibcTimespec , c:: c_int) -> c:: c_int) ;
94
94
#[ cfg( all( target_env = "gnu" , fix_y2038) ) ]
95
95
weak ! ( fn __futimens64( c:: c_int, * const LibcTimespec ) -> c:: c_int) ;
96
96
@@ -123,7 +123,7 @@ fn open_via_syscall(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result<Owned
123
123
unsafe {
124
124
syscall ! {
125
125
fn open(
126
- pathname: * const c :: c_char,
126
+ pathname: * const ffi :: c_char,
127
127
oflags: c:: c_int,
128
128
mode: c:: mode_t
129
129
) via SYS_open -> c:: c_int
@@ -178,7 +178,7 @@ fn openat_via_syscall(
178
178
syscall ! {
179
179
fn openat(
180
180
base_dirfd: c:: c_int,
181
- pathname: * const c :: c_char,
181
+ pathname: * const ffi :: c_char,
182
182
oflags: c:: c_int,
183
183
mode: c:: mode_t
184
184
) via SYS_openat -> c:: c_int
@@ -268,9 +268,11 @@ pub(crate) fn statvfs(filename: &CStr) -> io::Result<StatVfs> {
268
268
#[ inline]
269
269
pub ( crate ) fn readlink ( path : & CStr , buf : & mut [ u8 ] ) -> io:: Result < usize > {
270
270
unsafe {
271
- ret_usize (
272
- c:: readlink ( c_str ( path) , buf. as_mut_ptr ( ) . cast :: < c:: c_char > ( ) , buf. len ( ) ) as isize ,
273
- )
271
+ ret_usize ( c:: readlink (
272
+ c_str ( path) ,
273
+ buf. as_mut_ptr ( ) . cast :: < ffi:: c_char > ( ) ,
274
+ buf. len ( ) ,
275
+ ) as isize )
274
276
}
275
277
}
276
278
@@ -285,7 +287,7 @@ pub(crate) fn readlinkat(
285
287
ret_usize ( c:: readlinkat (
286
288
borrowed_fd ( dirfd) ,
287
289
c_str ( path) ,
288
- buf. as_mut_ptr ( ) . cast :: < c :: c_char > ( ) ,
290
+ buf. as_mut_ptr ( ) . cast :: < ffi :: c_char > ( ) ,
289
291
buf. len ( ) ,
290
292
) as isize )
291
293
}
@@ -345,9 +347,9 @@ pub(crate) fn linkat(
345
347
weak ! {
346
348
fn linkat(
347
349
c:: c_int,
348
- * const c :: c_char,
350
+ * const ffi :: c_char,
349
351
c:: c_int,
350
- * const c :: c_char,
352
+ * const ffi :: c_char,
351
353
c:: c_int
352
354
) -> c:: c_int
353
355
}
@@ -402,7 +404,7 @@ pub(crate) fn unlinkat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io
402
404
weak ! {
403
405
fn unlinkat(
404
406
c:: c_int,
405
- * const c :: c_char,
407
+ * const ffi :: c_char,
406
408
c:: c_int
407
409
) -> c:: c_int
408
410
}
@@ -455,9 +457,9 @@ pub(crate) fn renameat(
455
457
weak ! {
456
458
fn renameat(
457
459
c:: c_int,
458
- * const c :: c_char,
460
+ * const ffi :: c_char,
459
461
c:: c_int,
460
- * const c :: c_char
462
+ * const ffi :: c_char
461
463
) -> c:: c_int
462
464
}
463
465
// If we have `renameat`, use it.
@@ -499,9 +501,9 @@ pub(crate) fn renameat2(
499
501
weak_or_syscall ! {
500
502
fn renameat2(
501
503
olddirfd: c:: c_int,
502
- oldpath: * const c :: c_char,
504
+ oldpath: * const ffi :: c_char,
503
505
newdirfd: c:: c_int,
504
- newpath: * const c :: c_char,
506
+ newpath: * const ffi :: c_char,
505
507
flags: c:: c_uint
506
508
) via SYS_renameat2 -> c:: c_int
507
509
}
@@ -538,9 +540,9 @@ pub(crate) fn renameat2(
538
540
syscall ! {
539
541
fn renameat2(
540
542
olddirfd: c:: c_int,
541
- oldpath: * const c :: c_char,
543
+ oldpath: * const ffi :: c_char,
542
544
newdirfd: c:: c_int,
543
- newpath: * const c :: c_char,
545
+ newpath: * const ffi :: c_char,
544
546
flags: c:: c_uint
545
547
) via SYS_renameat2 -> c:: c_int
546
548
}
@@ -741,7 +743,7 @@ pub(crate) fn accessat(
741
743
weak ! {
742
744
fn faccessat(
743
745
c:: c_int,
744
- * const c :: c_char,
746
+ * const ffi :: c_char,
745
747
c:: c_int,
746
748
c:: c_int
747
749
) -> c:: c_int
@@ -848,14 +850,14 @@ pub(crate) fn utimensat(
848
850
weak ! {
849
851
fn utimensat(
850
852
c:: c_int,
851
- * const c :: c_char,
853
+ * const ffi :: c_char,
852
854
* const c:: timespec,
853
855
c:: c_int
854
856
) -> c:: c_int
855
857
}
856
858
extern "C" {
857
859
fn setattrlist (
858
- path : * const c :: c_char ,
860
+ path : * const ffi :: c_char ,
859
861
attr_list : * const Attrlist ,
860
862
attr_buf : * const c:: c_void ,
861
863
attr_buf_size : c:: size_t ,
@@ -1040,7 +1042,7 @@ pub(crate) fn chmodat(
1040
1042
syscall ! {
1041
1043
fn fchmodat(
1042
1044
base_dirfd: c:: c_int,
1043
- pathname: * const c :: c_char,
1045
+ pathname: * const ffi :: c_char,
1044
1046
mode: c:: mode_t
1045
1047
) via SYS_fchmodat -> c:: c_int
1046
1048
}
@@ -1070,7 +1072,7 @@ pub(crate) fn fclonefileat(
1070
1072
fn fclonefileat(
1071
1073
srcfd: BorrowedFd <' _>,
1072
1074
dst_dirfd: BorrowedFd <' _>,
1073
- dst: * const c :: c_char,
1075
+ dst: * const ffi :: c_char,
1074
1076
flags: c:: c_int
1075
1077
) via SYS_fclonefileat -> c:: c_int
1076
1078
}
@@ -1703,15 +1705,15 @@ pub(crate) fn memfd_create(name: &CStr, flags: MemfdFlags) -> io::Result<OwnedFd
1703
1705
#[ cfg( target_os = "freebsd" ) ]
1704
1706
weakcall ! {
1705
1707
fn memfd_create(
1706
- name: * const c :: c_char,
1708
+ name: * const ffi :: c_char,
1707
1709
flags: c:: c_uint
1708
1710
) -> c:: c_int
1709
1711
}
1710
1712
1711
1713
#[ cfg( linux_kernel) ]
1712
1714
weak_or_syscall ! {
1713
1715
fn memfd_create(
1714
- name: * const c :: c_char,
1716
+ name: * const ffi :: c_char,
1715
1717
flags: c:: c_uint
1716
1718
) via SYS_memfd_create -> c:: c_int
1717
1719
}
@@ -1732,7 +1734,7 @@ pub(crate) fn openat2(
1732
1734
syscall ! {
1733
1735
fn openat2(
1734
1736
base_dirfd: c:: c_int,
1735
- pathname: * const c :: c_char,
1737
+ pathname: * const ffi :: c_char,
1736
1738
how: * mut open_how,
1737
1739
size: usize
1738
1740
) via SYS_OPENAT2 -> c:: c_int
@@ -1922,12 +1924,12 @@ fn stat64_to_stat(s64: c::stat64) -> io::Result<Stat> {
1922
1924
#[ cfg( linux_kernel) ]
1923
1925
#[ allow( non_upper_case_globals) ]
1924
1926
mod sys {
1925
- use super :: { c, BorrowedFd , Statx } ;
1927
+ use super :: { c, ffi , BorrowedFd , Statx } ;
1926
1928
1927
1929
weak_or_syscall ! {
1928
1930
pub ( super ) fn statx(
1929
1931
dirfd_: BorrowedFd <' _>,
1930
- path: * const c :: c_char,
1932
+ path: * const ffi :: c_char,
1931
1933
flags: c:: c_int,
1932
1934
mask: c:: c_uint,
1933
1935
buf: * mut Statx
@@ -2405,7 +2407,7 @@ pub(crate) fn fsetxattr(
2405
2407
}
2406
2408
2407
2409
#[ cfg( any( apple, linux_kernel) ) ]
2408
- pub ( crate ) fn listxattr ( path : & CStr , list : & mut [ c :: c_char ] ) -> io:: Result < usize > {
2410
+ pub ( crate ) fn listxattr ( path : & CStr , list : & mut [ ffi :: c_char ] ) -> io:: Result < usize > {
2409
2411
#[ cfg( not( apple) ) ]
2410
2412
unsafe {
2411
2413
ret_usize ( c:: listxattr ( path. as_ptr ( ) , list. as_mut_ptr ( ) , list. len ( ) ) )
@@ -2423,7 +2425,7 @@ pub(crate) fn listxattr(path: &CStr, list: &mut [c::c_char]) -> io::Result<usize
2423
2425
}
2424
2426
2425
2427
#[ cfg( any( apple, linux_kernel) ) ]
2426
- pub ( crate ) fn llistxattr ( path : & CStr , list : & mut [ c :: c_char ] ) -> io:: Result < usize > {
2428
+ pub ( crate ) fn llistxattr ( path : & CStr , list : & mut [ ffi :: c_char ] ) -> io:: Result < usize > {
2427
2429
#[ cfg( not( apple) ) ]
2428
2430
unsafe {
2429
2431
ret_usize ( c:: llistxattr ( path. as_ptr ( ) , list. as_mut_ptr ( ) , list. len ( ) ) )
@@ -2441,7 +2443,7 @@ pub(crate) fn llistxattr(path: &CStr, list: &mut [c::c_char]) -> io::Result<usiz
2441
2443
}
2442
2444
2443
2445
#[ cfg( any( apple, linux_kernel) ) ]
2444
- pub ( crate ) fn flistxattr ( fd : BorrowedFd < ' _ > , list : & mut [ c :: c_char ] ) -> io:: Result < usize > {
2446
+ pub ( crate ) fn flistxattr ( fd : BorrowedFd < ' _ > , list : & mut [ ffi :: c_char ] ) -> io:: Result < usize > {
2445
2447
let fd = borrowed_fd ( fd) ;
2446
2448
2447
2449
#[ cfg( not( apple) ) ]
0 commit comments