From 6ec4a3d1b93b39d6b2cac9a11bf84a5c5e7be970 Mon Sep 17 00:00:00 2001 From: jas0n098 Date: Mon, 15 Jul 2024 00:55:58 +0000 Subject: [PATCH] Replace deprecated pthread functions (#290) pthread_attr_(set,get)stackaddr are deprecated and don't exist anymore on musl libc --- src/core/libraries/kernel/thread_management.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/libraries/kernel/thread_management.cpp b/src/core/libraries/kernel/thread_management.cpp index b31e777d..0838a4d5 100644 --- a/src/core/libraries/kernel/thread_management.cpp +++ b/src/core/libraries/kernel/thread_management.cpp @@ -318,7 +318,8 @@ int PS4_SYSV_ABI scePthreadAttrGetstackaddr(const ScePthreadAttr* attr, void** s return SCE_KERNEL_ERROR_EINVAL; } - int result = pthread_attr_getstackaddr(&(*attr)->pth_attr, stack_addr); + size_t stack_size = 0; + int result = pthread_attr_getstack(&(*attr)->pth_attr, stack_addr, &stack_size); return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL; } @@ -340,7 +341,10 @@ int PS4_SYSV_ABI scePthreadAttrSetstackaddr(ScePthreadAttr* attr, void* addr) { return SCE_KERNEL_ERROR_EINVAL; } - int result = pthread_attr_setstackaddr(&(*attr)->pth_attr, addr); + size_t stack_size = 0; + pthread_attr_getstacksize(&(*attr)->pth_attr, &stack_size); + + int result = pthread_attr_setstack(&(*attr)->pth_attr, addr, stack_size); return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL; }