We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a72936d commit cc58deaCopy full SHA for cc58dea
src/sys/mman.rs
@@ -555,9 +555,22 @@ pub unsafe fn madvise(
555
length: size_t,
556
advise: MmapAdvise,
557
) -> Result<()> {
558
+ let ptr = {
559
+ // The AIX signature of 'madvise()' differs from the POSIX specification,
560
+ // which expects 'void *' as the type of the 'addr' argument, whereas AIX uses
561
+ // 'caddr_t' (i.e., 'char *').
562
+ #[cfg(target_os = "aix")]
563
+ {
564
+ addr.as_ptr() as *mut u8
565
+ }
566
+ #[cfg(not(target_os = "aix"))]
567
568
+ addr.as_ptr()
569
570
+ };
571
+
572
unsafe {
- Errno::result(libc::madvise(addr.as_ptr(), length, advise as i32))
- .map(drop)
573
+ Errno::result(libc::madvise(ptr, length, advise as i32)).map(drop)
574
}
575
576
0 commit comments