AK, LibCore: Enable misc things on glibc
program_invocation_name, pthread_getattr_np(), EXECINFO_BACKTRACE are all glibc specifics (that other libcs may also have).
This commit is contained in:
parent
0143e5a36d
commit
4825919bcf
Notes:
sideshowbarker
2024-07-17 05:18:58 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/4825919bcf Pull-request: https://github.com/SerenityOS/serenity/pull/20958 Reviewed-by: https://github.com/ADKaster ✅
3 changed files with 5 additions and 5 deletions
|
@ -9,7 +9,7 @@
|
|||
#include <AK/Platform.h>
|
||||
#include <AK/StringView.h>
|
||||
|
||||
#if (defined(AK_OS_LINUX) && !defined(AK_OS_ANDROID)) || defined(AK_OS_BSD_GENERIC) || defined(AK_OS_SOLARIS)
|
||||
#if (defined(AK_OS_LINUX) && !defined(AK_OS_ANDROID)) || defined(AK_LIBC_GLIBC) || defined(AK_OS_BSD_GENERIC) || defined(AK_OS_SOLARIS)
|
||||
# define EXECINFO_BACKTRACE
|
||||
#endif
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#ifdef AK_OS_SERENITY
|
||||
# include <serenity.h>
|
||||
#elif defined(AK_OS_LINUX) or defined(AK_OS_MACOS) or defined(AK_OS_NETBSD) or defined(AK_OS_SOLARIS)
|
||||
#elif defined(AK_OS_LINUX) or defined(AK_LIBC_GLIBC) or defined(AK_OS_MACOS) or defined(AK_OS_NETBSD) or defined(AK_OS_SOLARIS)
|
||||
# include <pthread.h>
|
||||
#elif defined(AK_OS_FREEBSD) or defined(AK_OS_OPENBSD)
|
||||
# include <pthread.h>
|
||||
|
@ -32,12 +32,12 @@ StackInfo::StackInfo()
|
|||
perror("get_stack_bounds");
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
#elif defined(AK_OS_LINUX) or defined(AK_OS_FREEBSD) or defined(AK_OS_NETBSD) or defined(AK_OS_SOLARIS)
|
||||
#elif defined(AK_OS_LINUX) or defined(AK_LIBC_GLIBC) or defined(AK_OS_FREEBSD) or defined(AK_OS_NETBSD) or defined(AK_OS_SOLARIS)
|
||||
int rc;
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
|
||||
# ifdef AK_OS_LINUX
|
||||
# if defined(AK_OS_LINUX) or defined(AK_LIBC_GLIBC)
|
||||
if ((rc = pthread_getattr_np(pthread_self(), &attr)) != 0) {
|
||||
fprintf(stderr, "pthread_getattr_np: %s\n", strerror(rc));
|
||||
VERIFY_NOT_REACHED();
|
||||
|
|
|
@ -118,7 +118,7 @@ ErrorOr<String> Process::get_name()
|
|||
if (rc != 0)
|
||||
return Error::from_syscall("get_process_name"sv, -rc);
|
||||
return String::from_utf8(StringView { buffer, strlen(buffer) });
|
||||
#elif defined(AK_OS_LINUX) && !defined(AK_OS_ANDROID)
|
||||
#elif defined(AK_LIBC_GLIBC) || (defined(AK_OS_LINUX) && !defined(AK_OS_ANDROID))
|
||||
return String::from_utf8(StringView { program_invocation_name, strlen(program_invocation_name) });
|
||||
#elif defined(AK_OS_BSD_GENERIC)
|
||||
auto const* progname = getprogname();
|
||||
|
|
Loading…
Add table
Reference in a new issue