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
10 changes: 10 additions & 0 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,14 @@ if (CLR_CMAKE_HOST_UNIX)
endif()
elseif(CLR_CMAKE_HOST_NETBSD)
message("Detected NetBSD amd64")
elseif(CLR_CMAKE_HOST_OPENBSD)
if(CLR_CMAKE_HOST_UNIX_ARM64)
message("Detected OpenBSD aarch64")
elseif(CLR_CMAKE_HOST_UNIX_AMD64)
message("Detected OpenBSD amd64")
else()
message(FATAL_ERROR "Unsupported OpenBSD architecture")
endif()
elseif(CLR_CMAKE_HOST_SUNOS)
message("Detected SunOS amd64")
elseif(CLR_CMAKE_HOST_HAIKU)
Expand Down Expand Up @@ -785,6 +793,8 @@ if(CLR_CMAKE_TARGET_UNIX)
endif()
elseif(CLR_CMAKE_TARGET_NETBSD)
add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_OS>>>:TARGET_NETBSD>)
elseif(CLR_CMAKE_TARGET_OPENBSD)
add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_OS>>>:TARGET_OPENBSD>)
elseif(CLR_CMAKE_TARGET_SUNOS)
add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_OS>>>:TARGET_SUNOS>)
if(CLR_CMAKE_TARGET_OS_ILLUMOS)
Expand Down
6 changes: 5 additions & 1 deletion src/native/libs/System.Native/pal_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,10 @@ c_static_assert((int)PAL_DT_BLK == (int)DT_BLK);
c_static_assert((int)PAL_DT_REG == (int)DT_REG);
c_static_assert((int)PAL_DT_LNK == (int)DT_LNK);
c_static_assert((int)PAL_DT_SOCK == (int)DT_SOCK);
#ifdef DT_WHT // not available in OpenBSD
c_static_assert((int)PAL_DT_WHT == (int)DT_WHT);
#endif
#endif

// Validate that our Lock enum value are correct for the platform
c_static_assert(PAL_LOCK_SH == LOCK_SH);
Expand Down Expand Up @@ -1534,7 +1536,9 @@ int32_t SystemNative_GetPeerID(intptr_t socket, uid_t* euid)

// ucred causes Emscripten to fail even though it's defined,
// but getting peer credentials won't work for WebAssembly anyway
#if defined(SO_PEERCRED) && !defined(TARGET_WASM)
// ucred also causes OpeBSD to fail because the struct definition is named
// differently and on OpenBSD we can use getpeereid(3) instead anyways.
#if defined(SO_PEERCRED) && !defined(TARGET_WASM) && !defined(TARGET_OPENBSD)
struct ucred creds;
socklen_t len = sizeof(creds);
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &creds, &len) == 0)
Expand Down
3 changes: 2 additions & 1 deletion src/native/libs/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ check_c_source_compiles(

check_c_source_compiles(
"
#include <sys/types.h>
#include <sys/mount.h>
int main(void)
{
Expand Down Expand Up @@ -336,7 +337,7 @@ check_struct_has_member(
check_struct_has_member(
"struct statfs"
f_fstypename
"sys/mount.h"
"sys/types.h;sys/mount.h"
HAVE_STATFS_FSTYPENAME)

check_struct_has_member(
Expand Down
Loading