Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public static partial class PlatformDetection
public static bool IsNotCoreClrInterpreter => !IsCoreClrInterpreter;
public static bool IsFreeBSD => RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD"));
public static bool IsNetBSD => RuntimeInformation.IsOSPlatform(OSPlatform.Create("NETBSD"));
public static bool IsOpenBSD => RuntimeInformation.IsOSPlatform(OSPlatform.Create("OPENBSD"));
public static bool IsAndroid => RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID"));
public static bool IsNotAndroid => !IsAndroid;
public static bool IsAndroidX86 => IsAndroid && IsX86Process;
Expand All @@ -64,7 +65,7 @@ public static partial class PlatformDetection
public static bool IsAppleMobile => IsMacCatalyst || IsiOS || IstvOS;
public static bool IsNotAppleMobile => !IsAppleMobile;
public static bool IsNotNetFramework => !IsNetFramework;
public static bool IsBsdLike => IsApplePlatform || IsFreeBSD || IsNetBSD;
public static bool IsBsdLike => IsApplePlatform || IsFreeBSD || IsNetBSD || IsOpenBSD;

public static bool IsArmProcess => RuntimeInformation.ProcessArchitecture == Architecture.Arm;
public static bool IsNotArmProcess => !IsArmProcess;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-linux;$(NetCoreAppCurrent)-osx;$(NetCoreAppCurrent)-maccatalyst;$(NetCoreAppCurrent)-freebsd;$(NetCoreAppCurrent)</TargetFrameworks>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-linux;$(NetCoreAppCurrent)-osx;$(NetCoreAppCurrent)-maccatalyst;$(NetCoreAppCurrent)-freebsd;$(NetCoreAppCurrent)-openbsd;$(NetCoreAppCurrent)</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
</PropertyGroup>
Expand Down Expand Up @@ -77,7 +77,7 @@
Link="Common\Interop\Unix\Interop.PathConf.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'linux' or '$(TargetPlatformIdentifier)' == 'freebsd'">
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'linux' or '$(TargetPlatformIdentifier)' == 'freebsd' or '$(TargetPlatformIdentifier)' == 'openbsd'">
<Compile Include="System\IO\FileSystemWatcher.Linux.cs" />
<Compile Include="$(CommonPath)Interop\Linux\System.Native\Interop.INotify.cs"
Link="Common\Interop\Linux\Interop.inotify.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void Directory_Move_Multiple_From_Watched_To_Unwatched(int filesCount)
}

[Theory]
[SkipOnPlatform(TestPlatforms.FreeBSD, "Not supported on FreeBSD.")]
[SkipOnPlatform(TestPlatforms.FreeBSD | TestPlatforms.OpenBSD, "Not supported on FreeBSD and OpenBSD.")]
[InlineData(1)]
[InlineData(2)]
[InlineData(3)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public void File_Move_Multiple_From_Watched_To_Unwatched(int filesCount)
}

[Theory]
[SkipOnPlatform(TestPlatforms.OpenBSD, "libinotify on OpenBSD does not preserve event ordering.")]
[InlineData(1)]
[InlineData(2)]
[InlineData(3)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public void BeginInit_PausesEnableRaisingEvents()
[Theory]
[InlineData(true)]
[InlineData(false)]
[SkipOnPlatform(TestPlatforms.OpenBSD, "libinotify on OpenBSD can lose the Created event for a file that is created and immediately deleted on a freshly-started watch.")]
public void EndInit_ResumesPausedEnableRaisingEvents(bool setBeforeBeginInit)
{
FileSystemWatcherTest.Execute(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-linux;$(NetCoreAppCurrent)-osx;$(NetCoreAppCurrent)-maccatalyst;$(NetCoreAppCurrent)-freebsd</TargetFrameworks>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-linux;$(NetCoreAppCurrent)-osx;$(NetCoreAppCurrent)-maccatalyst;$(NetCoreAppCurrent)-freebsd;$(NetCoreAppCurrent)-openbsd</TargetFrameworks>
<IgnoreForCI Condition="'$(TargetOS)' == 'browser' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'tvos'">true</IgnoreForCI>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/native/libs/System.Native/extra_libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ macro(append_extra_system_libs NativeLibsExtra)
list(APPEND ${NativeLibsExtra} ${INOTIFY_LIBRARY})
elseif (CLR_CMAKE_TARGET_OPENBSD)
list(APPEND ${NativeLibsExtra} pthread)
find_library(INOTIFY_LIBRARY inotify HINTS ${CROSS_ROOTFS}/usr/local/lib/inotify)
list(APPEND ${NativeLibsExtra} ${INOTIFY_LIBRARY})
elseif (CLR_CMAKE_TARGET_SUNOS)
list(APPEND ${NativeLibsExtra} socket nsl)
elseif (CLR_CMAKE_TARGET_HAIKU)
Expand Down
8 changes: 5 additions & 3 deletions src/native/libs/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ elseif (CLR_CMAKE_TARGET_FREEBSD)
include_directories(SYSTEM ${CROSS_ROOTFS}/usr/local/include)
set(CMAKE_REQUIRED_INCLUDES ${CROSS_ROOTFS}/usr/local/include)
elseif (CLR_CMAKE_TARGET_OPENBSD)
include_directories(SYSTEM ${CROSS_ROOTFS}/usr/local/include ${CROSS_ROOTFS}/usr/local/heimdal/include)
set(CMAKE_REQUIRED_INCLUDES ${CROSS_ROOTFS}/usr/local/include ${CROSS_ROOTFS}/usr/local/heimdal/include)
include_directories(SYSTEM ${CROSS_ROOTFS}/usr/local/include ${CROSS_ROOTFS}/usr/local/heimdal/include ${CROSS_ROOTFS}/usr/local/include/inotify)
set(CMAKE_REQUIRED_INCLUDES ${CROSS_ROOTFS}/usr/local/include ${CROSS_ROOTFS}/usr/local/heimdal/include ${CROSS_ROOTFS}/usr/local/include/inotify)
elseif (CLR_CMAKE_TARGET_SUNOS)
# requires /opt/tools when building in Global Zone (GZ)
include_directories(SYSTEM /opt/local/include /opt/tools/include)
Expand Down Expand Up @@ -1052,8 +1052,10 @@ endif()
set (CMAKE_REQUIRED_LIBRARIES ${PREVIOUS_CMAKE_REQUIRED_LIBRARIES})

set (PREVIOUS_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
if (HAVE_SYS_INOTIFY_H AND (CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_OPENBSD))
if (HAVE_SYS_INOTIFY_H AND CLR_CMAKE_TARGET_FREEBSD)
set (CMAKE_REQUIRED_LIBRARIES "-linotify -L${CROSS_ROOTFS}/usr/local/lib")
elseif (HAVE_SYS_INOTIFY_H AND CLR_CMAKE_TARGET_OPENBSD)
set (CMAKE_REQUIRED_LIBRARIES "-linotify -lpthread -L${CROSS_ROOTFS}/usr/local/lib/inotify")
Comment thread
janvorli marked this conversation as resolved.
endif()

check_symbol_exists(
Expand Down
Loading