diff --git a/CMakeLists.txt b/CMakeLists.txt index f21556078..0380db38a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -917,6 +917,16 @@ if (NOT LWS_HAVE_REALLOC) set(realloc rpl_realloc) 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) + endif() +endif() if (MSVC) # Turn off stupid microsoft security warnings. @@ -1816,6 +1826,10 @@ if (UNIX) list(APPEND LIB_LIST m) endif() +if(SMARTOS) + list(APPEND LIB_LIST socket) +endif() + if (HAIKU) list(APPEND LIB_LIST network) endif() @@ -1824,8 +1838,6 @@ if (LWS_HAVE_LIBCAP) list(APPEND LIB_LIST cap ) endif() - - # Setup the linking for all libs. foreach (lib ${LWS_LIBRARIES}) target_link_libraries(${lib} ${LIB_LIST}) diff --git a/lib/misc/dir.c b/lib/misc/dir.c index fdd732363..f3d878163 100644 --- a/lib/misc/dir.c +++ b/lib/misc/dir.c @@ -103,6 +103,33 @@ lws_dir(const char *dirpath, void *user, lws_dir_callback_function cb) * files are LDOT_UNKNOWN */ +#if defined(__smartos__) + struct stat s; + stat(namelist[i]->d_name, &s); + switch (s.st_mode) { + case S_IFBLK: + lde.type = LDOT_BLOCK; + break; + case S_IFCHR: + lde.type = LDOT_CHAR; + break; + case S_IFDIR: + lde.type = LDOT_DIR; + break; + case S_IFIFO: + lde.type = LDOT_FIFO; + break; + case S_IFLNK: + lde.type = LDOT_LINK; + break; + case S_IFREG: + lde.type = LDOT_FILE; + break; + default: + lde.type = LDOT_UNKNOWN; + break; + } +#else switch (namelist[i]->d_type) { case DT_BLK: lde.type = LDOT_BLOCK; @@ -129,6 +156,7 @@ lws_dir(const char *dirpath, void *user, lws_dir_callback_function cb) lde.type = LDOT_UNKNOWN; break; } +#endif if (cb(dirpath, user, &lde)) { while (i++ < n) free(namelist[i]); diff --git a/lib/plat/unix/private.h b/lib/plat/unix/private.h index 80b557273..1702d4b05 100644 --- a/lib/plat/unix/private.h +++ b/lib/plat/unix/private.h @@ -168,6 +168,6 @@ delete_from_fd(const struct lws_context *context, int fd); * Solaris 11.X only supports POSIX 2001, MSG_NOSIGNAL appears in * POSIX 2008. */ -#ifdef __sun +#if defined(__sun) && !defined(__smartos__) #define MSG_NOSIGNAL 0 #endif