1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

Subject: Build on SmartOS

This commit is contained in:
Mike Owens 2019-08-11 23:57:27 +00:00 committed by Andy Green
parent 69447d0445
commit 22ece2c0e4
3 changed files with 43 additions and 3 deletions

View file

@ -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})

View file

@ -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]);

View file

@ -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