SmartOS: detection/build to all Illumos
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8bc5d0f..63fa67e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -956,13 +956,14 @@
 endif()
 
 if (UNIX)
-	execute_process(COMMAND uname -n OUTPUT_VARIABLE NODENAME)
-	# Need to chomp the \n at end of output.
-	string(REGEX REPLACE "[\n]+" "" NODENAME "${NODENAME}")
-
-	if( NODENAME STREQUAL "smartos" )
-		add_definitions( "-D__smartos__" )
-		set(SMARTOS 1)
+	execute_process( COMMAND grep -c illumos /lib/ld.so.1 
+			 OUTPUT_VARIABLE ILLUMOS ERROR_QUIET )
+	# Chomp the \n at end of output.
+	string(REGEX REPLACE "[\n]+" "" ILLUMOS "${ILLUMOS}")
+	
+	if(NOT ${ILLUMOS} MATCHES "0")
+		add_definitions( "-D__illumos__" )
+		set(ILLUMOS 1)
 	endif()
 endif()
 
@@ -1876,7 +1877,7 @@
 	list(APPEND LIB_LIST m)
 endif()
 
-if(SMARTOS)
+if(ILLUMOS)
 	list(APPEND LIB_LIST socket)
 endif()
 
diff --git a/lib/misc/dir.c b/lib/misc/dir.c
index ca5fe83..f98f494 100644
--- a/lib/misc/dir.c
+++ b/lib/misc/dir.c
@@ -106,7 +106,7 @@
 		 * files are LDOT_UNKNOWN
 		 */
 
-#if defined(__smartos__)
+#if defined(__illumos__)
         struct stat s;
         stat(namelist[i]->d_name, &s);
 		switch (s.st_mode) {
diff --git a/lib/plat/unix/private-lib-plat-unix.h b/lib/plat/unix/private-lib-plat-unix.h
index 8cf0b9d..ca0cb1c 100644
--- a/lib/plat/unix/private-lib-plat-unix.h
+++ b/lib/plat/unix/private-lib-plat-unix.h
@@ -171,6 +171,6 @@
  * Solaris 11.X only supports POSIX 2001, MSG_NOSIGNAL appears in
  * POSIX 2008.
  */
-#if defined(__sun) && !defined(__smartos__)
+#if defined(__sun) && !defined(__illumos__)
  #define MSG_NOSIGNAL 0
 #endif