Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 May 2025 07:31:17 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 85192b37a3f1 - stable/14 - libthr: add __thr_aligned_alloc_offset()
Message-ID:  <202505020731.5427VHv0075878@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505020731.5427VHv0075878>