Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 2025 11:48:33 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 846229d60b4f - main - libthr: add __thr_aligned_alloc_offset()
Message-ID:  <202504251148.53PBmXbS053566@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=846229d60b4fd6def666ce32cfc475ed96aabaf3

commit 846229d60b4fd6def666ce32cfc475ed96aabaf3
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-04-24 21:23:06 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-04-25 11:48:09 +0000

    libthr: add __thr_aligned_alloc_offset()
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
---
 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 9a81d6d1bd6b..48af9d1ea929 100644
--- a/lib/libthr/thread/thr_malloc.c
+++ b/lib/libthr/thread/thr_malloc.c
@@ -119,6 +119,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 926e868293cd..dc5be08a0760 100644
--- a/lib/libthr/thread/thr_private.h
+++ b/lib/libthr/thread/thr_private.h
@@ -1014,6 +1014,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?202504251148.53PBmXbS053566>