File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change
1
+ Cast the 'addr' argument of 'madvise()' to '* mut u8' on AIX to match the signature in the AIX libc.
Original file line number Diff line number Diff line change @@ -555,9 +555,22 @@ pub unsafe fn madvise(
555
555
length : size_t ,
556
556
advise : MmapAdvise ,
557
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
+
558
572
unsafe {
559
- Errno :: result ( libc:: madvise ( addr. as_ptr ( ) , length, advise as i32 ) )
560
- . map ( drop)
573
+ Errno :: result ( libc:: madvise ( ptr, length, advise as i32 ) ) . map ( drop)
561
574
}
562
575
}
563
576
You can’t perform that action at this time.
0 commit comments