Skip to content

Commit bf9eae8

Browse files
Added support for Solaris (#94)
Tested on illumos distribution OmniOS Community Edition.
1 parent 7d9f232 commit bf9eae8

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ if(WIN32)
169169
if(OpenSSL_FOUND)
170170
target_link_libraries(${PROJECT_NAME} PRIVATE Crypt32 Secur32)
171171
endif(OpenSSL_FOUND)
172+
else(WIN32)
173+
target_link_libraries(${PROJECT_NAME} PRIVATE pthread $<$<PLATFORM_ID:SunOS>:socket>)
172174
endif(WIN32)
173175

174176
file(WRITE ${CMAKE_BINARY_DIR}/test_atomic.cpp

trantor/net/InetAddress.cc

+2
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ const uint32_t *InetAddress::ip6NetEndian() const
217217
// assert(family() == AF_INET6);
218218
#if defined __linux__ || defined __HAIKU__
219219
return addr6_.sin6_addr.s6_addr32;
220+
#elif defined __sun
221+
return addr6_.sin6_addr._S6_un._S6_u32;
220222
#elif defined _WIN32
221223
// TODO is this OK ?
222224
const struct in6_addr_uint *addr_temp =

trantor/utils/Date.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,8 @@ Date::Date(unsigned int year,
363363
tm.tm_min = minute;
364364
tm.tm_sec = second;
365365
epoch = mktime(&tm);
366-
microSecondsSinceEpoch_ = epoch * MICRO_SECONDS_PRE_SEC + microSecond;
366+
microSecondsSinceEpoch_ =
367+
static_cast<int64_t>(epoch) * MICRO_SECONDS_PRE_SEC + microSecond;
367368
}
368369

369370
} // namespace trantor

trantor/utils/Date.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <stdint.h>
1919
#include <string>
2020

21-
#define MICRO_SECONDS_PRE_SEC 1000000
21+
#define MICRO_SECONDS_PRE_SEC 1000000LL
2222

2323
namespace trantor
2424
{

trantor/utils/Logger.cc

+5
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ void Logger::formatTime()
119119
{
120120
threadId_ = getthrid();
121121
}
122+
#elif defined __sun
123+
if (threadId_ == 0)
124+
{
125+
threadId_ = static_cast<uint64_t>(pthread_self());
126+
}
122127
#elif defined _WIN32 || defined __HAIKU__
123128
if (threadId_ == 0)
124129
{

0 commit comments

Comments
 (0)