Merge pull request #6069 from alorbach/macos-fix-buildissues

runtime: fix Darwin build regressions
This commit is contained in:
Rainer Gerhards 2025-09-03 13:58:32 +02:00 committed by GitHub
commit 508a40ebb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 2 deletions

View File

@ -776,7 +776,6 @@ static rsRetVal cslchCallHdlr(cslCmdHdlr_t *pThis, uchar **ppConfLine) {
goto finalize_it;
}
finalize_it:
RETiRet;
}

View File

@ -1322,10 +1322,28 @@ static void ATTR_NONNULL() * wrkr(void *arg) {
DBGPRINTF("prctl failed, not setting thread name for '%s'\n", thrdName);
}
#elif defined(HAVE_PTHREAD_SETNAME_NP)
#if defined(__APPLE__)
/* The macOS variant takes only the thread name and returns an int. */
int r = pthread_setname_np((char *)shortThrdName);
if (r != 0) {
DBGPRINTF("pthread_setname_np failed, not setting thread name for '%s'\n", shortThrdName);
}
#elif defined(__FreeBSD__)
/* FreeBSD variant has a void return type. */
pthread_setname_np(pthread_self(), (char *)shortThrdName);
#elif defined(__NetBSD__)
/* NetBSD variant takes a format string and returns an int. */
int r = pthread_setname_np(pthread_self(), "%s", (void *)shortThrdName);
if (r != 0) {
DBGPRINTF("pthread_setname_np failed, not setting thread name for '%s'\n", shortThrdName);
}
#else
/* The glibc variant takes thread ID and name, and returns an int. */
int r = pthread_setname_np(pthread_self(), (char *)shortThrdName);
if (r != 0) {
DBGPRINTF("pthread_setname_np failed, not setting thread name for '%s'\n", thrdName);
DBGPRINTF("pthread_setname_np failed, not setting thread name for '%s'\n", shortThrdName);
}
#endif
#endif
if ((localRet = statsobj.Construct(&wrkrData->stats)) == RS_RET_OK) {

View File

@ -72,6 +72,9 @@
#ifdef HAVE_PATHS_H
#include <paths.h>
#endif
#ifndef _PATH_UTMP
#define _PATH_UTMP "/var/run/utmp"
#endif
#ifdef HAVE_LIBSYSTEMD
#include <systemd/sd-daemon.h>
#include <systemd/sd-login.h>