git: 85192b37a3f1 - stable/14 - libthr: add __thr_aligned_alloc_offset()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 02 May 2025 07:31:17 UTC
The branch stable/14 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=85192b37a3f1af0dd6a7215b50cc6b6e2c5ccac4
commit 85192b37a3f1af0dd6a7215b50cc6b6e2c5ccac4
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-04-24 21:23:06 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-05-02 07:30:51 +0000
libthr: add __thr_aligned_alloc_offset()
(cherry picked from commit 846229d60b4fd6def666ce32cfc475ed96aabaf3)
---
lib/libthr/thread/thr_malloc.c | 13 +++++++++++++
lib/libthr/thread/thr_private.h | 1 +
2 files changed, 14 insertions(+)
diff --git a/lib/libthr/thread/thr_malloc.c b/lib/libthr/thread/thr_malloc.c
index dbc9e39e3c28..e973a00427f3 100644
--- a/lib/libthr/thread/thr_malloc.c
+++ b/lib/libthr/thread/thr_malloc.c
@@ -120,6 +120,19 @@ __thr_malloc(size_t nbytes)
return (res);
}
+void *
+__thr_aligned_alloc_offset(size_t align, size_t size, size_t offset)
+{
+ struct pthread *curthread;
+ void *res;
+
+ curthread = _get_curthread();
+ thr_malloc_lock(curthread);
+ res = __crt_aligned_alloc_offset(align, size, offset);
+ thr_malloc_unlock(curthread);
+ return (res);
+}
+
void *
__thr_realloc(void *cp, size_t nbytes)
{
diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h
index b34c084ad04d..a81452e2a251 100644
--- a/lib/libthr/thread/thr_private.h
+++ b/lib/libthr/thread/thr_private.h
@@ -1012,6 +1012,7 @@ void __thr_pshared_destroy(void *key) __hidden;
void __thr_pshared_atfork_pre(void) __hidden;
void __thr_pshared_atfork_post(void) __hidden;
+void *__thr_aligned_alloc_offset(size_t align, size_t size, size_t offset);
void *__thr_calloc(size_t num, size_t size);
void __thr_free(void *cp);
void *__thr_malloc(size_t nbytes);