From 69178f7c297a5cc4d2fb96aef8e24b855cf4a6af Mon Sep 17 00:00:00 2001 From: Jonathan Dygert Date: Tue, 28 May 2024 12:23:06 -0400 Subject: [PATCH] Make VxWorks shims `unsafe` `pread` and `pwrite` don't technically need to be `unsafe`, but it is consistent and more convenient for avoiding the `unused_unsafe` warning across targets. --- src/vxworks/mod.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index 4e23f250ba5a0..bc4dbddae0a9f 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -1867,11 +1867,16 @@ safe_f! { } } -pub fn pread(_fd: ::c_int, _buf: *mut ::c_void, _count: ::size_t, _offset: off64_t) -> ::ssize_t { +pub unsafe fn pread( + _fd: ::c_int, + _buf: *mut ::c_void, + _count: ::size_t, + _offset: off64_t, +) -> ::ssize_t { -1 } -pub fn pwrite( +pub unsafe fn pwrite( _fd: ::c_int, _buf: *const ::c_void, _count: ::size_t, @@ -1879,7 +1884,12 @@ pub fn pwrite( ) -> ::ssize_t { -1 } -pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int { + +pub unsafe fn posix_memalign( + memptr: *mut *mut ::c_void, + align: ::size_t, + size: ::size_t, +) -> ::c_int { // check to see if align is a power of 2 and if align is a multiple // of sizeof(void *) if (align & align - 1 != 0) || (align as usize % size_of::<::size_t>() != 0) {