mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-09 17:44:48 +09:00
Define dirent d_type for Solaris based OS (#34263)
This commit is contained in:
parent
5e6b441047
commit
9f0c54098a
7 changed files with 38 additions and 7 deletions
|
@ -179,11 +179,15 @@ endif(CLR_CMAKE_HOST_UNIX)
|
|||
if(CLR_CMAKE_HOST_LINUX)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:ASM>:-Wa,--noexecstack>)
|
||||
add_link_options(-Wl,--build-id=sha1 -Wl,-z,relro,-z,now)
|
||||
endif(CLR_CMAKE_HOST_LINUX)
|
||||
if(CLR_CMAKE_HOST_FREEBSD)
|
||||
elseif(CLR_CMAKE_HOST_FREEBSD)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:ASM>:-Wa,--noexecstack>)
|
||||
add_link_options(LINKER:--build-id=sha1)
|
||||
endif(CLR_CMAKE_HOST_FREEBSD)
|
||||
elseif(CLR_CMAKE_HOST_SUNOS)
|
||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} /opt/local/include)
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /opt/local/lib)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector")
|
||||
endif()
|
||||
|
||||
#------------------------------------
|
||||
# Definitions (for platform)
|
||||
|
|
|
@ -40,9 +40,7 @@ function(set_common_libs TargetType)
|
|||
target_link_libraries (${DOTNET_PROJECT_NAME} "pthread")
|
||||
endif()
|
||||
|
||||
if(CLR_CMAKE_TARGET_LINUX)
|
||||
target_link_libraries (${DOTNET_PROJECT_NAME} "dl")
|
||||
endif()
|
||||
target_link_libraries (${DOTNET_PROJECT_NAME} ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
if (NOT ${TargetType} STREQUAL "lib-static")
|
||||
|
|
|
@ -6,6 +6,9 @@ project(hostmisc)
|
|||
|
||||
set(DOTNET_PROJECT_NAME "hostmisc")
|
||||
|
||||
include(configure.cmake)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
# CMake does not recommend using globbing since it messes with the freshness checks
|
||||
set(SOURCES
|
||||
trace.cpp
|
||||
|
|
6
src/installer/corehost/cli/hostmisc/config.h.in
Normal file
6
src/installer/corehost/cli/hostmisc/config.h.in
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef _PAL_CONFIG_H_INCLUDED
|
||||
#define _PAL_CONFIG_H_INCLUDED 1
|
||||
|
||||
#cmakedefine01 HAVE_DIRENT_D_TYPE
|
||||
|
||||
#endif
|
5
src/installer/corehost/cli/hostmisc/configure.cmake
Normal file
5
src/installer/corehost/cli/hostmisc/configure.cmake
Normal file
|
@ -0,0 +1,5 @@
|
|||
include(CheckStructHasMember)
|
||||
|
||||
check_struct_has_member("struct dirent" d_type dirent.h HAVE_DIRENT_D_TYPE)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
|
@ -46,6 +46,7 @@
|
|||
#define xout std::cout
|
||||
#define DIR_SEPARATOR '/'
|
||||
#define PATH_SEPARATOR ':'
|
||||
#undef _X
|
||||
#define _X(s) s
|
||||
|
||||
#define S_OK 0x00000000
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <fnmatch.h>
|
||||
#include <ctime>
|
||||
#include <pwd.h>
|
||||
#include "config.h"
|
||||
|
||||
#if defined(TARGET_OSX)
|
||||
#include <mach-o/dyld.h>
|
||||
|
@ -27,6 +28,13 @@
|
|||
#define symlinkEntrypointExecutable "/proc/curproc/exe"
|
||||
#endif
|
||||
|
||||
#if !HAVE_DIRENT_D_TYPE
|
||||
#define DT_UNKNOWN 0
|
||||
#define DT_DIR 4
|
||||
#define DT_REG 8
|
||||
#define DT_LNK 10
|
||||
#endif
|
||||
|
||||
pal::string_t pal::to_string(int value) { return std::to_string(value); }
|
||||
|
||||
pal::string_t pal::to_lower(const pal::string_t& in)
|
||||
|
@ -821,8 +829,14 @@ static void readdir(const pal::string_t& path, const pal::string_t& pattern, boo
|
|||
continue;
|
||||
}
|
||||
|
||||
#if HAVE_DIRENT_D_TYPE
|
||||
int dirEntryType = entry->d_type;
|
||||
#else
|
||||
int dirEntryType = DT_UNKNOWN;
|
||||
#endif
|
||||
|
||||
// We are interested in files only
|
||||
switch (entry->d_type)
|
||||
switch (dirEntryType)
|
||||
{
|
||||
case DT_DIR:
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue