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(
555555 length : size_t ,
556556 advise : MmapAdvise ,
557557) -> 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+
558572 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)
561574 }
562575}
563576
You can’t perform that action at this time.
0 commit comments