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(); 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 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 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