Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ include_directories("${PROJECT_BINARY_DIR}")

add_executable(SpeedTest ${SOURCE_FILES})

if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
target_link_libraries(SpeedTest socket nsl)
endif()

INCLUDE (CheckIncludeFiles)
find_package(CURL REQUIRED)
find_package(LibXml2 REQUIRED)
Expand Down
12 changes: 12 additions & 0 deletions SpeedTestClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,18 @@ bool SpeedTestClient::mkSocket() {
if (server == nullptr) {
return false;
}
#elif defined(__sun) || defined(__illumos__)
struct hostent server;
char tmpbuf[BUFSIZ];
int errnop = 0;

/* illumos/Solaris: gethostbyname_r returns hostent* and takes (.., int *h_errnop) */
struct hostent *result = gethostbyname_r(
hostp.first.c_str(), &server, (char *)&tmpbuf, BUFSIZ, &errnop
);
if (result == nullptr) {
return false;
}
#else
struct hostent server;
char tmpbuf[BUFSIZ];
Expand Down