implement more things

This commit is contained in:
nora 2023-10-07 21:50:57 +02:00
parent 119d0f1443
commit 9e2cf38cd5
11 changed files with 177 additions and 12 deletions

View file

@ -1,3 +1,5 @@
use libuwuc::error::Error;
#[no_mangle]
pub unsafe extern "C" fn memset(ptr: *mut u8, constant: u8, len: usize) {
libuwuc::mem::memset(ptr, constant, len)
@ -8,6 +10,11 @@ pub unsafe extern "C" fn memcpy(dest: *mut u8, src: *const u8, size: usize) -> *
libuwuc::mem::memcpy(dest, src, size)
}
#[no_mangle]
pub unsafe extern "C" fn memmove(dest: *mut u8, src: *const u8, size: usize) -> *mut u8 {
libuwuc::mem::memmove(dest, src, size)
}
#[no_mangle]
pub unsafe extern "C" fn memcmp(s1: *const u8, s2: *const u8, size: usize) -> i32 {
libuwuc::mem::memcmp(s1, s2, size)
@ -22,3 +29,10 @@ pub unsafe extern "C" fn bcmp(s1: *const u8, s2: *const u8, size: usize) -> i32
pub unsafe extern "C" fn strlen(s: *const u8) -> usize {
libuwuc::mem::strlen(s)
}
#[no_mangle]
pub unsafe extern "C" fn strerror(errnum: Error) -> *const u8 {
libuwuc::error::strerror(errnum)
.map(str::as_ptr)
.unwrap_or(core::ptr::null())
}