Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Add FreeBSD support to System.Console. #2031

Merged
merged 1 commit into from
Jun 13, 2015
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
80 changes: 80 additions & 0 deletions src/Common/src/Interop/FreeBSD/Interop.Errors.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

internal static partial class Interop
{
/// <summary>Common Unix errno error codes.</summary>
internal static partial class Errors
{
// These values were defined in:
// include/errno.h

internal const int EDEADLK = 11;

internal const int EAGAIN = 35;
internal const int EWOULDBLOCK = EAGAIN;
internal const int EINPROGRESS = 36;
internal const int EALREADY = 37;
internal const int ENOTSOCK = 38;
internal const int EDESTADDRREQ = 39;
internal const int EMSGSIZE = 40;
internal const int EPROTOTYPE = 41;
internal const int ENOPROTOOPT = 42;
internal const int EPROTONOSUPPORT = 43;
internal const int ESOCKTNOSUPPORT = 44;
internal const int EOPNOTSUPP = 45;
internal const int ENOTSUP = EOPNOTSUPP;
internal const int EPFNOSUPPORT = 46;
internal const int EAFNOSUPPORT = 47;
internal const int EADDRINUSE = 48;
internal const int EADDRNOTAVAIL = 49;
internal const int ENETDOWN = 50;
internal const int ENETUNREACH = 51;
internal const int ENETRESET = 52;
internal const int ECONNABORTED = 53;
internal const int ECONNRESET = 54;
internal const int ENOBUFS = 55;
internal const int EISCONN = 56;
internal const int ENOTCONN = 57;
internal const int ESHUTDOWN = 58;
internal const int ETOOMANYREFS = 59;
internal const int ETIMEDOUT = 60;
internal const int ECONNREFUSED = 61;
internal const int ELOOP = 62;
internal const int ENAMETOOLONG = 63;
internal const int EHOSTDOWN = 64;
internal const int EHOSTUNREACH = 65;
internal const int ENOTEMPTY = 66;
internal const int EPROCLIM = 67;
internal const int EUSERS = 68;
internal const int EDQUOT = 69;
internal const int ESTALE = 70;
internal const int EREMOTE = 71;
internal const int EBADRPC = 72;
internal const int ERPCMISMATCH = 73;
internal const int EPROGUNAVAIL = 74;
internal const int EPROGMISMATCH = 75;
internal const int EPROCUNAVAIL = 76;
internal const int ENOLCK = 77;
internal const int ENOSYS = 78;
internal const int EFTYPE = 79;
internal const int EAUTH = 80;
internal const int ENEEDAUTH = 81;
internal const int EIDRM = 82;
internal const int ENOMSG = 83;
internal const int EOVERFLOW = 84;
internal const int ECANCELED = 85;
internal const int EILSEQ = 86;
internal const int ENOATTR = 87;
internal const int EDOOFUS = 88;
internal const int EBADMSG = 89;
internal const int EMULTIHOP = 90;
internal const int ENOLINK = 91;
internal const int EPROTO = 92;
internal const int ENOTCAPABLE = 93;
internal const int ECAPMODE = 94;
internal const int ENOTRECOVERABLE = 95;
internal const int EOWNERDEAD = 96;
internal const int ELAST = 96;
}
}
10 changes: 10 additions & 0 deletions src/Common/src/Interop/FreeBSD/Interop.Libraries.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

internal static partial class Interop
{
private static partial class Libraries
{
internal const string LibRt = "librt"; // POSIX Realtime Extensions library
}
}
24 changes: 24 additions & 0 deletions src/Common/src/Interop/FreeBSD/libc/Interop.OpenFlags.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;

internal static partial class Interop
{
internal static partial class libc
{
[Flags]
internal enum OpenFlags
{
O_RDONLY = 0x0000,
O_WRONLY = 0x0001,
O_RDWR = 0x0002,
O_CREAT = 0x0200,
O_TRUNC = 0x0400,
O_EXCL = 0x0800,
O_SYNC = 0x0080,
O_ASYNC = 0x0040,
O_CLOEXEC = 0x00100000,
}
}
}
10 changes: 10 additions & 0 deletions src/System.Console/System.Console.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Console.Tests", "tes
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
FreeBSD_Debug|Any CPU = FreeBSD_Debug|Any CPU
FreeBSD_Release|Any CPU = FreeBSD_Release|Any CPU
Linux_Debug|Any CPU = Linux_Debug|Any CPU
Linux_Release|Any CPU = Linux_Release|Any CPU
OSX_Debug|Any CPU = OSX_Debug|Any CPU
Expand All @@ -23,6 +25,10 @@ Global
Windows_Release|Any CPU = Windows_Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F9DF2357-81B4-4317-908E-512DA9395583}.FreeBSD_Debug|Any CPU.ActiveCfg = FreeBSD_Debug|Any CPU
{F9DF2357-81B4-4317-908E-512DA9395583}.FreeBSD_Debug|Any CPU.Build.0 = FreeBSD_Debug|Any CPU
{F9DF2357-81B4-4317-908E-512DA9395583}.FreeBSD_Release|Any CPU.ActiveCfg = FreeBSD_Release|Any CPU
{F9DF2357-81B4-4317-908E-512DA9395583}.FreeBSD_Release|Any CPU.Build.0 = FreeBSD_Release|Any CPU
{F9DF2357-81B4-4317-908E-512DA9395583}.Linux_Debug|Any CPU.ActiveCfg = Linux_Debug|Any CPU
{F9DF2357-81B4-4317-908E-512DA9395583}.Linux_Debug|Any CPU.Build.0 = Linux_Debug|Any CPU
{F9DF2357-81B4-4317-908E-512DA9395583}.Linux_Release|Any CPU.ActiveCfg = Linux_Release|Any CPU
Expand All @@ -35,6 +41,10 @@ Global
{F9DF2357-81B4-4317-908E-512DA9395583}.Windows_Debug|Any CPU.Build.0 = Windows_Debug|Any CPU
{F9DF2357-81B4-4317-908E-512DA9395583}.Windows_Release|Any CPU.ActiveCfg = Windows_Release|Any CPU
{F9DF2357-81B4-4317-908E-512DA9395583}.Windows_Release|Any CPU.Build.0 = Windows_Release|Any CPU
{99E5069D-241F-48A6-8F29-404B4AED72BF}.FreeBSD_Debug|Any CPU.ActiveCfg = FreeBSD_Debug|Any CPU
{99E5069D-241F-48A6-8F29-404B4AED72BF}.FreeBSD_Debug|Any CPU.Build.0 = FreeBSD_Debug|Any CPU
{99E5069D-241F-48A6-8F29-404B4AED72BF}.FreeBSD_Release|Any CPU.ActiveCfg = FreeBSD_Release|Any CPU
{99E5069D-241F-48A6-8F29-404B4AED72BF}.FreeBSD_Release|Any CPU.Build.0 = FreeBSD_Release|Any CPU
{99E5069D-241F-48A6-8F29-404B4AED72BF}.Linux_Debug|Any CPU.ActiveCfg = Linux_Debug|Any CPU
{99E5069D-241F-48A6-8F29-404B4AED72BF}.Linux_Debug|Any CPU.Build.0 = Linux_Debug|Any CPU
{99E5069D-241F-48A6-8F29-404B4AED72BF}.Linux_Release|Any CPU.ActiveCfg = Linux_Release|Any CPU
Expand Down
10 changes: 10 additions & 0 deletions src/System.Console/src/System.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<!-- Help VS understand available configurations -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'FreeBSD_Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'FreeBSD_Release|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Linux_Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Linux_Release|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'OSX_Debug|AnyCPU' " />
Expand Down Expand Up @@ -140,6 +142,14 @@
<Link>Common\Interop\Unix\Interop.SetConsoleCtrlHandler.cs"</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition=" '$(TargetsFreeBSD)' == 'true' ">
<Compile Include="$(CommonPath)\Interop\FreeBSD\Interop.Errors.cs">
<Link>Common\Interop\FreeBSD\Interop.Errors.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\FreeBSD\libc\Interop.OpenFlags.cs">
<Link>Common\Interop\FreeBSD\Interop.OpenFlags.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition=" '$(TargetsLinux)' == 'true' ">
<Compile Include="$(CommonPath)\Interop\Linux\Interop.Errors.cs">
<Link>Common\Interop\Linux\Interop.Errors.cs</Link>
Expand Down