diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index db4f0f8c790..d601acee1dc 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -28,8 +28,9 @@ #include "jvm_md.h" #include "runtime/osInfo.hpp" #include "utilities/exceptions.hpp" -#include "utilities/ostream.hpp" +#include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" +#include "utilities/ostream.hpp" #ifdef __APPLE__ # include #endif @@ -1027,14 +1028,6 @@ class os: AllStatic { class Posix; #endif - // FIXME - some random stuff that was in os_windows.hpp -#ifdef _WINDOWS - // strtok_s is the Windows thread-safe equivalent of POSIX strtok_r -# define strtok_r strtok_s -# define S_ISCHR(mode) (((mode) & _S_IFCHR) == _S_IFCHR) -# define S_ISFIFO(mode) (((mode) & _S_IFIFO) == _S_IFIFO) -#endif - #ifndef OS_NATIVE_THREAD_CREATION_FAILED_MSG #define OS_NATIVE_THREAD_CREATION_FAILED_MSG "unable to create native thread: possibly out of memory or process/resource limits reached" #endif diff --git a/src/hotspot/share/utilities/globalDefinitions_visCPP.hpp b/src/hotspot/share/utilities/globalDefinitions_visCPP.hpp index 5f26a082d7c..3f22948118d 100644 --- a/src/hotspot/share/utilities/globalDefinitions_visCPP.hpp +++ b/src/hotspot/share/utilities/globalDefinitions_visCPP.hpp @@ -37,6 +37,7 @@ # include # include # include // for offsetof +# include # include // for stream.cpp # include // for _isnan # include // for va_list @@ -80,6 +81,18 @@ inline int strncasecmp(const char *s1, const char *s2, size_t n) { return _strnicmp(s1,s2,n); } +// VS doesn't provide strtok_r, which is a POSIX function. Instead, it +// provides the same function under the name strtok_s. Note that this is +// *not* the same as the C99 Annex K strtok_s. VS provides that function +// under the name strtok_s_l. Make strtok_r a synonym so we can use that name +// in shared code. +const auto strtok_r = strtok_s; + +// VS doesn't provide POSIX macros S_ISFIFO or S_IFIFO. It doesn't even +// provide _S_ISFIFO, per its usual naming convention for POSIX stuff. But it +// does provide _S_IFIFO, so we can roll our own S_ISFIFO. +#define S_ISFIFO(mode) (((mode) & _S_IFIFO) == _S_IFIFO) + // Checking for nanness inline int g_isnan(jfloat f) { return _isnan(f); }