1- /* HASH CRC-32:0xf216ada9 */
1+ /* HASH CRC-32:0xb9c36ef4 */
22/* Copyright (c) 2019-2025 Griefer@Work *
33 * *
44 * This software is provided 'as-is', without any express or implied *
@@ -37,7 +37,7 @@ DECL_BEGIN
3737 * Compare two thread identifiers
3838 * @return: 0 : Given threads are non-equal
3939 * @return: * : Given threads are equal */
40- INTERN ATTR_SECTION (".text.crt.sched.pthread" ) ATTR_CONST WUNUSED int
40+ INTERN ATTR_SECTION (".text.crt.sched.pthread.core.thread " ) ATTR_CONST WUNUSED int
4141NOTHROW (LIBCCALL libc_pthread_equal )(pthread_t thr1 ,
4242 pthread_t thr2 ) {
4343 return thr1 == thr2 ;
@@ -53,7 +53,7 @@ NOTHROW(LIBCCALL libc_pthread_equal)(pthread_t thr1,
5353 * same `once_control' argument. `once_control' must point to a static or
5454 * extern variable initialized to `PTHREAD_ONCE_INIT'.
5555 * @return: EOK: Success */
56- INTERN ATTR_SECTION (".text.crt.sched.pthread" ) ATTR_INOUT (1 ) NONNULL ((2 )) errno_t
56+ INTERN ATTR_SECTION (".text.crt.sched.pthread.core.once " ) ATTR_INOUT (1 ) NONNULL ((2 )) errno_t
5757NOTHROW_CB (LIBCCALL libc_pthread_once )(pthread_once_t * once_control ,
5858 void (LIBCCALL * init_routine )(void )) {
5959#undef __PRIVATE_PTHREAD_ONCE_USES_FUTEX
@@ -180,7 +180,7 @@ NOTHROW_CB(LIBCCALL libc_pthread_once)(pthread_once_t *once_control,
180180/* Function called to call the cleanup handler. As an extern inline
181181 * function the compiler is free to decide inlining the change when
182182 * needed or fall back on the copy which must exist somewhere else */
183- INTERN ATTR_SECTION (".text.crt.sched.pthread" ) ATTR_INOUT (1 ) void
183+ INTERN ATTR_SECTION (".text.crt.sched.pthread.ext.gnu.cleanup " ) ATTR_INOUT (1 ) void
184184NOTHROW_NCX (LIBCCALL libc___pthread_cleanup_routine )(struct __pthread_cleanup_frame * frame ) {
185185 if (frame -> __do_it )
186186 (* frame -> __cancel_routine )(frame -> __cancel_arg );
@@ -190,7 +190,7 @@ NOTHROW_NCX(LIBCCALL libc___pthread_cleanup_routine)(struct __pthread_cleanup_fr
190190 * Initialize the spinlock `self'. If `pshared' is nonzero
191191 * the spinlock can be shared between different processes
192192 * @return: EOK: Success */
193- INTERN ATTR_SECTION (".text.crt.sched.pthread" ) ATTR_OUT (1 ) errno_t
193+ INTERN ATTR_SECTION (".text.crt.sched.pthread.core.spin " ) ATTR_OUT (1 ) errno_t
194194NOTHROW_NCX (LIBCCALL libc_pthread_spin_init )(pthread_spinlock_t * self ,
195195 int pshared ) {
196196 (void )pshared ;
@@ -200,7 +200,7 @@ NOTHROW_NCX(LIBCCALL libc_pthread_spin_init)(pthread_spinlock_t *self,
200200/* >> pthread_spin_destroy(3)
201201 * Destroy the spinlock `self'
202202 * @return: EOK: Success */
203- INTERN ATTR_SECTION (".text.crt.sched.pthread" ) ATTR_INOUT (1 ) errno_t
203+ INTERN ATTR_SECTION (".text.crt.sched.pthread.core.spin " ) ATTR_INOUT (1 ) errno_t
204204NOTHROW_NCX (LIBCCALL libc_pthread_spin_destroy )(pthread_spinlock_t * self ) {
205205 COMPILER_IMPURE ();
206206 (void )self ; /* no-op */
@@ -211,7 +211,7 @@ NOTHROW_NCX(LIBCCALL libc_pthread_spin_destroy)(pthread_spinlock_t *self) {
211211/* >> pthread_spin_lock(3)
212212 * Wait until spinlock `self' is retrieved
213213 * @return: EOK: Success */
214- INTERN ATTR_SECTION (".text.crt.sched.pthread" ) ATTR_INOUT (1 ) errno_t
214+ INTERN ATTR_SECTION (".text.crt.sched.pthread.core.spin " ) ATTR_INOUT (1 ) errno_t
215215NOTHROW_NCX (LIBCCALL libc_pthread_spin_lock )(pthread_spinlock_t * self ) {
216216 while (libc_pthread_spin_trylock (self ) != 0 )
217217 __hybrid_yield ();
@@ -223,7 +223,7 @@ NOTHROW_NCX(LIBCCALL libc_pthread_spin_lock)(pthread_spinlock_t *self) {
223223 * Try to lock spinlock `self'
224224 * @return: EOK: Success
225225 * @return: EBUSY: Lock has already been acquired */
226- INTERN ATTR_SECTION (".text.crt.sched.pthread" ) WUNUSED ATTR_INOUT (1 ) errno_t
226+ INTERN ATTR_SECTION (".text.crt.sched.pthread.core.spin " ) WUNUSED ATTR_INOUT (1 ) errno_t
227227NOTHROW_NCX (LIBCCALL libc_pthread_spin_trylock )(pthread_spinlock_t * self ) {
228228 if (__hybrid_atomic_xch (self , 1 , __ATOMIC_ACQUIRE ) == 0 )
229229 return 0 ;
@@ -241,7 +241,7 @@ NOTHROW_NCX(LIBCCALL libc_pthread_spin_trylock)(pthread_spinlock_t *self) {
241241/* >> pthread_spin_unlock(3)
242242 * Release spinlock `self'
243243 * @return: EOK: Success */
244- INTERN ATTR_SECTION (".text.crt.sched.pthread" ) ATTR_INOUT (1 ) errno_t
244+ INTERN ATTR_SECTION (".text.crt.sched.pthread.core.spin " ) ATTR_INOUT (1 ) errno_t
245245NOTHROW_NCX (LIBCCALL libc_pthread_spin_unlock )(pthread_spinlock_t * self ) {
246246 __hybrid_atomic_store (self , 0 , __ATOMIC_RELEASE );
247247 return 0 ;
@@ -256,7 +256,7 @@ NOTHROW_NCX(LIBCCALL libc_pthread_spin_unlock)(pthread_spinlock_t *self) {
256256 * function will no longer block, but simply return immediately.
257257 * @return: EOK: Success
258258 * @return: ENOMEM: Insufficient memory to create the key */
259- INTERN ATTR_SECTION (".text.crt.sched.pthread" ) ATTR_OUT (1 ) errno_t
259+ INTERN ATTR_SECTION (".text.crt.sched.pthread.core.tls " ) ATTR_OUT (1 ) errno_t
260260NOTHROW_NCX (LIBCCALL libc_pthread_key_create_once_np )(pthread_key_t * key ,
261261 void (LIBKCALL * destr_function )(void * )) {
262262 pthread_key_t kv ;
@@ -301,7 +301,7 @@ NOTHROW_NCX(LIBCCALL libc_pthread_key_create_once_np)(pthread_key_t *key,
301301#include <bits/os/cpu_set.h>
302302/* >> pthread_num_processors_np(3)
303303 * @return: * : The number of cpus that the calling thread is able to run on */
304- INTERN ATTR_SECTION (".text.crt.sched.pthread_ext " ) WUNUSED __STDC_INT_AS_SIZE_T
304+ INTERN ATTR_SECTION (".text.crt.sched.pthread.ext.misc.affinity " ) WUNUSED __STDC_INT_AS_SIZE_T
305305NOTHROW_NCX (LIBCCALL libc_pthread_num_processors_np )(void ) {
306306 cpu_set_t cset ;
307307 if unlikely (libc_sched_getaffinity (0 , sizeof (cset ), & cset ) != 0 )
@@ -315,7 +315,7 @@ NOTHROW_NCX(LIBCCALL libc_pthread_num_processors_np)(void) {
315315 * @return: EOK: Success
316316 * @return: EINVAL: `n' was specified as less than `1'
317317 * @return: * : Same as `errno' after a call to `sched_setaffinity(2)' */
318- INTERN ATTR_SECTION (".text.crt.sched.pthread_ext " ) errno_t
318+ INTERN ATTR_SECTION (".text.crt.sched.pthread.ext.misc.affinity " ) errno_t
319319NOTHROW_NCX (LIBCCALL libc_pthread_set_num_processors_np )(int n ) {
320320 int i , result ;
321321 cpu_set_t cset ;
@@ -342,7 +342,7 @@ NOTHROW_NCX(LIBCCALL libc_pthread_set_num_processors_np)(int n) {
342342 * calling program), and 0 otherwise. Additionally, -1 is returned
343343 * if the calling thread "hasn't been initialized", though this
344344 * isn't a case that can actually happen under KOS's implementation. */
345- INTERN ATTR_SECTION (".text.crt.sched.pthread_ext " ) ATTR_CONST WUNUSED int
345+ INTERN ATTR_SECTION (".text.crt.sched.pthread.ext.tls_globals " ) ATTR_CONST WUNUSED int
346346NOTHROW (LIBCCALL libc_pthread_main_np )(void ) {
347347
348348 return libc_pthread_equal (libc_pthread_mainthread_np (), libc_pthread_self ());
@@ -358,7 +358,7 @@ NOTHROW(LIBCCALL libc_pthread_main_np)(void) {
358358 * - `pthread_resume_all_np(3)'
359359 * Alias for `pthread_attr_setstartsuspended_np(self, 1)'
360360 * @return: EOK: Always returned */
361- INTERN ATTR_SECTION (".text.crt.sched.pthread_ext " ) ATTR_INOUT (1 ) errno_t
361+ INTERN ATTR_SECTION (".text.crt.sched.pthread.ext.kos.suspend " ) ATTR_INOUT (1 ) errno_t
362362NOTHROW_NCX (LIBCCALL libc_pthread_attr_setcreatesuspend_np )(pthread_attr_t * __restrict self ) {
363363 return libc_pthread_attr_setstartsuspended_np (self , 1 );
364364}
@@ -375,7 +375,7 @@ NOTHROW_NCX(LIBCCALL libc_pthread_attr_setcreatesuspend_np)(pthread_attr_t *__re
375375 * @return: ESRCH: The thread has already been terminated
376376 * @return: ENOMEM: Insufficient memory
377377 * @return: EOVERFLOW: The suspension counter can't go any higher */
378- INTERN ATTR_SECTION (".text.crt.sched.pthread_ext " ) errno_t
378+ INTERN ATTR_SECTION (".text.crt.sched.pthread.ext.kos.suspend " ) errno_t
379379NOTHROW_NCX (LIBCCALL libc_pthread_suspend_np )(pthread_t self ) {
380380 return libc_pthread_suspend2_np (self , NULL );
381381}
@@ -388,7 +388,7 @@ NOTHROW_NCX(LIBCCALL libc_pthread_suspend_np)(pthread_t self) {
388388 * @see pthread_suspend_np, pthread_suspend2_np, pthread_resume2_np, pthread_continue_np
389389 * @return: EOK: Success
390390 * @return: ESRCH: The thread has already been terminated */
391- INTERN ATTR_SECTION (".text.crt.sched.pthread_ext " ) errno_t
391+ INTERN ATTR_SECTION (".text.crt.sched.pthread.ext.kos.suspend " ) errno_t
392392NOTHROW_NCX (LIBCCALL libc_pthread_resume_np )(pthread_t self ) {
393393 return libc_pthread_resume2_np (self , NULL );
394394}
@@ -398,7 +398,7 @@ NOTHROW_NCX(LIBCCALL libc_pthread_resume_np)(pthread_t self) {
398398#include <libc/errno.h>
399399/* >> pthread_getunique_np(3)
400400 * Wrapper around `pthread_gettid_np(3)' that is also available on some other platforms. */
401- INTERN ATTR_SECTION (".text.crt.sched.pthread_ext " ) ATTR_PURE WUNUSED errno_t
401+ INTERN ATTR_SECTION (".text.crt.sched.pthread.ext.kos.tid " ) ATTR_PURE WUNUSED errno_t
402402NOTHROW_NCX (LIBCCALL libc_pthread_getunique_np )(pthread_t self ,
403403 pthread_id_np_t * ptid ) {
404404 if unlikely ((* ptid = crt_pthread_gettid_np (self )) == 0 ) {
@@ -410,7 +410,7 @@ NOTHROW_NCX(LIBCCALL libc_pthread_getunique_np)(pthread_t self,
410410 }
411411 return EOK ;
412412}
413- INTERN ATTR_SECTION (".text.crt.sched.pthread_ext " ) WUNUSED NONNULL ((1 )) errno_t
413+ INTERN ATTR_SECTION (".text.crt.sched.pthread.ext.misc " ) WUNUSED NONNULL ((1 )) errno_t
414414NOTHROW_NCX (LIBCCALL libc_pthread_switch_add_np )(pthread_switch_routine_t routine ) {
415415 /* This right here also matches what FreeBSD current does (that is: returning "ENOTSUP") */
416416 COMPILER_IMPURE ();
@@ -425,12 +425,12 @@ NOTHROW_NCX(LIBCCALL libc_pthread_switch_add_np)(pthread_switch_routine_t routin
425425}
426426DEFINE_INTERN_ALIAS_P (libc_pthread_switch_delete_np ,libc_pthread_switch_add_np ,WUNUSED NONNULL ((1 )),errno_t ,NOTHROW_NCX ,LIBCCALL ,(pthread_switch_routine_t routine ),(routine ));
427427#include <sys/single_threaded.h>
428- INTERN ATTR_SECTION (".text.crt.sched.pthread_ext " ) int
428+ INTERN ATTR_SECTION (".text.crt.sched.pthread.ext.misc " ) int
429429NOTHROW_NCX (LIBCCALL libc_pthread_is_threaded_np )(void ) {
430430 return !__libc_single_threaded ;
431431}
432432#include <bits/crt/pthreadtypes.h>
433- INTERN ATTR_SECTION (".text.crt.sched.pthread_ext " ) size_t
433+ INTERN ATTR_SECTION (".text.crt.sched.pthread.ext.misc " ) size_t
434434NOTHROW_NCX (LIBCCALL libc_pthread_get_stacksize_np )(pthread_t self ) {
435435 size_t result = 0 ;
436436 pthread_attr_t attr ;
@@ -444,7 +444,7 @@ NOTHROW_NCX(LIBCCALL libc_pthread_get_stacksize_np)(pthread_t self) {
444444 return result ;
445445}
446446#include <bits/crt/pthreadtypes.h>
447- INTERN ATTR_SECTION (".text.crt.sched.pthread_ext " ) void *
447+ INTERN ATTR_SECTION (".text.crt.sched.pthread.ext.misc " ) void *
448448NOTHROW_NCX (LIBCCALL libc_pthread_get_stackaddr_np )(pthread_t self ) {
449449 void * result = NULL ;
450450 pthread_attr_t attr ;
0 commit comments