From ba5930dbc20dba0dbb3d39496313f6be4468cf01 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 8 Dec 2024 22:20:59 +0000 Subject: [PATCH] adding POSIX memccpy and mempcpy GNU extension. [memccpy](https://pubs.opengroup.org/onlinepubs/9699919799/functions/memccpy.html) [mempcpy](https://man7.org/linux/man-pages/man3/mempcpy.3.html) --- libc-test/semver/linux-gnu.txt | 1 + libc-test/semver/unix.txt | 1 + src/unix/linux_like/linux/gnu/mod.rs | 2 ++ src/unix/mod.rs | 1 + 4 files changed, 5 insertions(+) diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index 5cbb3bc519e1a..c3a39a3099913 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -632,6 +632,7 @@ malloc_stats malloc_trim malloc_usable_size mallopt +mempcpy mq_notify nl_mmap_hdr nl_mmap_req diff --git a/libc-test/semver/unix.txt b/libc-test/semver/unix.txt index 093dde173137c..052c24178dfcc 100644 --- a/libc-test/semver/unix.txt +++ b/libc-test/semver/unix.txt @@ -638,6 +638,7 @@ localtime_r lseek lstat malloc +memccpy memchr memcmp memcpy diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index e6272d3547b1b..1d4c9c498cb67 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -1439,6 +1439,8 @@ extern "C" { timeout: *const crate::timespec, sigmask: *const crate::sigset_t, ) -> c_int; + + pub fn mempcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; } cfg_if! { diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 0ab7ae0fd19ad..9154a0c43cfbe 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -681,6 +681,7 @@ extern "C" { pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; + pub fn memccpy(dest: *mut c_void, src: *const c_void, c: c_int, n: size_t) -> *mut c_void; } extern "C" {