From c087e4af3c8819fc20d42c4aa33f21ba44998efc Mon Sep 17 00:00:00 2001 From: Gordon Ross Date: Sat, 21 Jun 2025 18:00:13 -0400 Subject: [PATCH 1/4] Fix illumos compile error at minipal/debugger.c:127 dotnet/runtime/src/native/minipal/debugger.c:127:5: error: implicit declaration of function 'snprintf' [-Werror=implicit-function-declaration] 127 | snprintf(statusFilename, sizeof(statusFilename), "/proc/%d/status", getpid()); | ^~~~~~~~ --- src/native/minipal/debugger.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/native/minipal/debugger.c b/src/native/minipal/debugger.c index 4fdef053a225a3..763f12079caabd 100644 --- a/src/native/minipal/debugger.c +++ b/src/native/minipal/debugger.c @@ -32,6 +32,7 @@ #include #define MINIPAL_DEBUGGER_PRESENT_CHECK #elif defined(__sun) +#include #include #include #include From 1d5def1be831e6800b4c6654f419e92d7eaf4003 Mon Sep 17 00:00:00 2001 From: Gordon Ross Date: Sat, 21 Jun 2025 18:04:36 -0400 Subject: [PATCH 2/4] Fix illumos compile error in minipal/thread.h src/native/minipal/thread.h:73:23: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] 73 | tid = (size_t)(void*)pthread_self(); | ^~~~~~~~~~~~~~~~~~~~~ --- src/native/minipal/thread.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/native/minipal/thread.h b/src/native/minipal/thread.h index 7655f4bf2c7f88..48405dfb3195ae 100644 --- a/src/native/minipal/thread.h +++ b/src/native/minipal/thread.h @@ -69,6 +69,8 @@ static inline size_t minipal_get_current_thread_id(void) tid = (size_t)_lwp_self(); #elif defined(__HAIKU__) tid = (size_t)find_thread(NULL); +#elif defined(__sun) + tid = (size_t)pthread_self(); #else tid = (size_t)(void*)pthread_self(); #endif From 48b08896aafc01fd1df1a146c3c0cc8aec7b867c Mon Sep 17 00:00:00 2001 From: Gordon Ross Date: Sat, 21 Jun 2025 18:19:19 -0400 Subject: [PATCH 3/4] Fix illumos compile error in native/libs/System.Native/pal_mount.c src/native/libs/System.Native/pal_mount.c:164:38: error: 'struct statvfs' has no member named 'f_type' 164 | *formatType = (int64_t)(stats.f_type); | ^ --- src/native/libs/Common/pal_config.h.in | 1 + src/native/libs/System.Native/pal_mount.c | 8 ++++++++ src/native/libs/configure.cmake | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/src/native/libs/Common/pal_config.h.in b/src/native/libs/Common/pal_config.h.in index f64132cd449968..580cd68a574335 100644 --- a/src/native/libs/Common/pal_config.h.in +++ b/src/native/libs/Common/pal_config.h.in @@ -31,6 +31,7 @@ #cmakedefine01 HAVE_MNTINFO #cmakedefine01 HAVE_STATFS_FSTYPENAME #cmakedefine01 HAVE_STATVFS_FSTYPENAME +#cmakedefine01 HAVE_STATVFS_BASETYPE #cmakedefine01 HAVE_NON_LEGACY_STATFS #cmakedefine01 HAVE_STRCPY_S #cmakedefine01 HAVE_STRLCPY diff --git a/src/native/libs/System.Native/pal_mount.c b/src/native/libs/System.Native/pal_mount.c index 758575e6954f33..386eba5ede1162 100644 --- a/src/native/libs/System.Native/pal_mount.c +++ b/src/native/libs/System.Native/pal_mount.c @@ -159,6 +159,14 @@ SystemNative_GetFileSystemTypeNameForMountPoint(const char* name, char* formatNa } SafeStringCopy(formatNameBuffer, Int32ToSizeT(bufferLength), stats.f_fstypename); *formatType = -1; +#elif HAVE_STATVFS_BASETYPE + if (bufferLength < _FSTYPSZ) // SunOS + { + errno = ERANGE; + result = -1; + } + SafeStringCopy(formatNameBuffer, Int32ToSizeT(bufferLength), stats.f_basetype); + *formatType = -1; #else SafeStringCopy(formatNameBuffer, Int32ToSizeT(bufferLength), ""); *formatType = (int64_t)(stats.f_type); diff --git a/src/native/libs/configure.cmake b/src/native/libs/configure.cmake index 561ab9229986bd..5348adb6b2e0b5 100644 --- a/src/native/libs/configure.cmake +++ b/src/native/libs/configure.cmake @@ -324,6 +324,12 @@ check_struct_has_member( "sys/mount.h" HAVE_STATVFS_FSTYPENAME) +check_struct_has_member( + "struct statvfs" + f_basetype + "sys/statvfs.h" + HAVE_STATVFS_BASETYPE) + set(CMAKE_EXTRA_INCLUDE_FILES dirent.h) # statfs: Find whether this struct exists From 417d47c8a4b01a8531e8bc82b786b440e895f38a Mon Sep 17 00:00:00 2001 From: Gordon Ross Date: Sat, 21 Jun 2025 18:10:27 -0400 Subject: [PATCH 4/4] Fix illumos compile error in coreclr/pal/src/thread/thread.cpp /home/gwr/dotnet/runtime/src/coreclr/pal/src/thread/thread.cpp:1367:5: error: 'cid' was not declared in this scope 1367 | cid = CLOCK_THREAD_CPUTIME_ID; | ^~~ --- src/coreclr/pal/src/thread/thread.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/coreclr/pal/src/thread/thread.cpp b/src/coreclr/pal/src/thread/thread.cpp index fe48f04dfe639b..31ccdabef28d55 100644 --- a/src/coreclr/pal/src/thread/thread.cpp +++ b/src/coreclr/pal/src/thread/thread.cpp @@ -1330,10 +1330,9 @@ CorUnix::GetThreadTimesInternal( CPalThread *pThread; CPalThread *pTargetThread; IPalObject *pobjThread = NULL; + clockid_t cid; #ifdef __sun int fd; -#else // __sun - clockid_t cid; #endif // __sun pThread = InternalGetCurrentThread();