diff --git a/src/coreclr/pal/src/config.h.in b/src/coreclr/pal/src/config.h.in index c68421302e1153..75507804d23a00 100644 --- a/src/coreclr/pal/src/config.h.in +++ b/src/coreclr/pal/src/config.h.in @@ -62,7 +62,7 @@ #cmakedefine01 HAVE_SEMAPHORE_H #cmakedefine01 HAS_SYSV_SEMAPHORES #cmakedefine01 HAS_PTHREAD_MUTEXES -#cmakedefine01 HAVE_TTRACE +#cmakedefine HAVE_TTRACE #cmakedefine01 HAVE_PIPE2 #cmakedefine01 HAVE_SCHED_GETAFFINITY #cmakedefine01 HAVE_SCHED_SETAFFINITY diff --git a/src/coreclr/pal/src/debug/debug.cpp b/src/coreclr/pal/src/debug/debug.cpp index 3e20cb7c1c1534..f0a504452c59bb 100644 --- a/src/coreclr/pal/src/debug/debug.cpp +++ b/src/coreclr/pal/src/debug/debug.cpp @@ -42,9 +42,9 @@ SET_DEFAULT_DEBUG_CHANNEL(DEBUG); // some headers have code with asserts, so do #include #if HAVE_PROCFS_CTL #include -#elif HAVE_TTRACE // HAVE_PROCFS_CTL +#elif defined(HAVE_TTRACE) // HAVE_PROCFS_CTL #include -#else // HAVE_TTRACE +#else // defined(HAVE_TTRACE) #include #endif // HAVE_PROCFS_CTL #if HAVE_VM_READ diff --git a/src/native/eventpipe/ds-ipc-pal-socket.c b/src/native/eventpipe/ds-ipc-pal-socket.c index f5831a6e21c72f..20e3f11c52383e 100644 --- a/src/native/eventpipe/ds-ipc-pal-socket.c +++ b/src/native/eventpipe/ds-ipc-pal-socket.c @@ -530,14 +530,14 @@ ipc_socket_accept ( ds_ipc_socket_t client_socket; DS_ENTER_BLOCKING_PAL_SECTION; do { -#if defined(HAVE_ACCEPT4) && defined(SOCK_CLOEXEC) +#if HAVE_ACCEPT4 && defined(SOCK_CLOEXEC) client_socket = accept4 (s, address, address_len, SOCK_CLOEXEC); #else client_socket = accept (s, address, address_len); #endif } while (ipc_retry_syscall (client_socket)); -#if !defined(HAVE_ACCEPT4) || !defined(SOCK_CLOEXEC) +#if !HAVE_ACCEPT4 || !defined(SOCK_CLOEXEC) #if defined(FD_CLOEXEC) if (client_socket != -1) { diff --git a/src/native/external/libunwind-version.txt b/src/native/external/libunwind-version.txt index 0953763c6bc1a7..4b47acff5ed4f0 100644 --- a/src/native/external/libunwind-version.txt +++ b/src/native/external/libunwind-version.txt @@ -4,6 +4,7 @@ https://github.com/libunwind/libunwind/commit/b3ca1b59a795a617877c01fe5d299ab7a0 Reapply changes from https://github.com/dotnet/runtime/commit/1b5719c2e3dde393531eaeb5b5cde05dabeef5b8 Apply https://github.com/libunwind/libunwind/pull/317 Apply https://github.com/libunwind/libunwind/pull/333 +Apply https://github.com/libunwind/libunwind/pull/342 For LoongArch64: Apply https://github.com/libunwind/libunwind/pull/316 and https://github.com/libunwind/libunwind/pull/322 diff --git a/src/native/external/libunwind/src/ptrace/_UPT_access_fpreg.c b/src/native/external/libunwind/src/ptrace/_UPT_access_fpreg.c index bae343833932e5..178a97c0d88f84 100644 --- a/src/native/external/libunwind/src/ptrace/_UPT_access_fpreg.c +++ b/src/native/external/libunwind/src/ptrace/_UPT_access_fpreg.c @@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "_UPT_internal.h" -#if HAVE_DECL_PTRACE_POKEUSER || HAVE_TTRACE +#if HAVE_DECL_PTRACE_POKEUSER || defined(HAVE_TTRACE) int _UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, int write, void *arg) diff --git a/src/native/external/libunwind/src/ptrace/_UPT_access_mem.c b/src/native/external/libunwind/src/ptrace/_UPT_access_mem.c index 79bde25dffc056..5d6511c56c6c25 100644 --- a/src/native/external/libunwind/src/ptrace/_UPT_access_mem.c +++ b/src/native/external/libunwind/src/ptrace/_UPT_access_mem.c @@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "_UPT_internal.h" -#if HAVE_DECL_PTRACE_POKEDATA || HAVE_TTRACE +#if HAVE_DECL_PTRACE_POKEDATA || defined(HAVE_TTRACE) int _UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, void *arg) diff --git a/src/native/external/libunwind/src/ptrace/_UPT_access_reg.c b/src/native/external/libunwind/src/ptrace/_UPT_access_reg.c index 0e247053f13bcf..033d3aae7f4eaa 100644 --- a/src/native/external/libunwind/src/ptrace/_UPT_access_reg.c +++ b/src/native/external/libunwind/src/ptrace/_UPT_access_reg.c @@ -77,7 +77,7 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, Debug (1, "bad register %s [%u] (error: %s)\n", unw_regname(reg), reg, strerror (errno)); return -UNW_EBADREG; } -#elif HAVE_DECL_PTRACE_POKEUSER || HAVE_TTRACE +#elif HAVE_DECL_PTRACE_POKEUSER || defined(HAVE_TTRACE) int _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, void *arg) diff --git a/src/native/libs/System.Native/pal_io.c b/src/native/libs/System.Native/pal_io.c index 5061e4b114cd3b..e05f57a5fec17a 100644 --- a/src/native/libs/System.Native/pal_io.c +++ b/src/native/libs/System.Native/pal_io.c @@ -211,7 +211,7 @@ static void ConvertFileStatus(const struct stat_* src, FileStatus* dst) dst->BirthTimeNsec = 0; #endif -#if defined(HAVE_STAT_FLAGS) && defined(UF_HIDDEN) +#if HAVE_STAT_FLAGS && defined(UF_HIDDEN) dst->UserFlags = ((src->st_flags & UF_HIDDEN) == UF_HIDDEN) ? PAL_UF_HIDDEN : 0; #else dst->UserFlags = 0; @@ -1607,7 +1607,7 @@ int32_t SystemNative_LockFileRegion(intptr_t fd, int64_t offset, int64_t length, struct flock lockArgs; #endif -#if defined(TARGET_ANDROID) && defined(HAVE_FLOCK64) +#if defined(TARGET_ANDROID) && HAVE_FLOCK64 // On Android, fcntl is always implemented by fcntl64 but before https://github.com/aosp-mirror/platform_bionic/commit/09e77f35ab8d291bf88302bb9673aaa518c6bcb0 // there was no remapping of F_SETLK to F_SETLK64 when _FILE_OFFSET_BITS=64 (which we set in eng/native/configurecompiler.cmake) so we need to always pass F_SETLK64 int command = F_SETLK64; @@ -1640,7 +1640,7 @@ int32_t SystemNative_LChflags(const char* path, uint32_t flags) int32_t SystemNative_LChflagsCanSetHiddenFlag(void) { -#if defined(HAVE_LCHFLAGS) +#if HAVE_LCHFLAGS return SystemNative_CanGetHiddenFlag(); #else return false; @@ -1649,7 +1649,7 @@ int32_t SystemNative_LChflagsCanSetHiddenFlag(void) int32_t SystemNative_CanGetHiddenFlag(void) { -#if defined(UF_HIDDEN) && defined(HAVE_STAT_FLAGS) +#if HAVE_STAT_FLAGS && defined(UF_HIDDEN) return true; #else return false; diff --git a/src/native/libs/System.Native/pal_mount.c b/src/native/libs/System.Native/pal_mount.c index 8612775cc9c53f..bf8c49a6c37118 100644 --- a/src/native/libs/System.Native/pal_mount.c +++ b/src/native/libs/System.Native/pal_mount.c @@ -33,7 +33,7 @@ int32_t SystemNative_GetAllMountPoints(MountPointFound onFound) { #if HAVE_MNTINFO // getmntinfo returns pointers to OS-internal structs, so we don't need to worry about free'ing the object -#if defined(HAVE_STATFS) +#if HAVE_STATFS struct statfs* mounts = NULL; #else struct statvfs* mounts = NULL; diff --git a/src/native/libs/System.Native/pal_networking.c b/src/native/libs/System.Native/pal_networking.c index 3236fe26acfeba..a4deeeb8d20f49 100644 --- a/src/native/libs/System.Native/pal_networking.c +++ b/src/native/libs/System.Native/pal_networking.c @@ -1501,7 +1501,7 @@ int32_t SystemNative_Accept(intptr_t socket, uint8_t* socketAddress, int32_t* so socklen_t addrLen = (socklen_t)*socketAddressLen; int accepted; -#if defined(HAVE_ACCEPT4) && defined(SOCK_CLOEXEC) +#if HAVE_ACCEPT4 && defined(SOCK_CLOEXEC) while ((accepted = accept4(fd, (struct sockaddr*)socketAddress, &addrLen, SOCK_CLOEXEC)) < 0 && errno == EINTR); #else while ((accepted = accept(fd, (struct sockaddr*)socketAddress, &addrLen)) < 0 && errno == EINTR);