Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 709afe1

Browse files
committed
Use shims for open, close, unlink, shm_open, shm_unlink
1 parent 2cd3926 commit 709afe1

File tree

35 files changed

+347
-293
lines changed

35 files changed

+347
-293
lines changed

src/Common/src/Interop/FreeBSD/libc/Interop.OpenFlags.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/Common/src/Interop/Linux/libc/Interop.OpenFlags.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
// Copyright (c) Microsoft. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4+
using System;
45
using System.Runtime.InteropServices;
56

67
internal static partial class Interop
78
{
89
internal static partial class libc
910
{
11+
[Flags]
12+
internal enum Pipe2Flags
13+
{
14+
O_CLOEXEC = 0x80000,
15+
}
16+
1017
[DllImport(Libraries.Libc, SetLastError = true)]
11-
internal static extern unsafe int pipe2(int* pipefd, int flags);
18+
internal static extern unsafe int pipe2(int* pipefd, Pipe2Flags flags);
1219
}
1320
}

src/Common/src/Interop/Linux/librt/Interop.shm_open.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/Common/src/Interop/OSX/libc/Interop.OpenFlags.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/Common/src/Interop/OSX/libsystem_kernel/Interop.shm_open.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/Common/src/Interop/Unix/libc/Interop.close.cs renamed to src/Common/src/Interop/Unix/System.Native/Interop.Close.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
internal static partial class Interop
77
{
8-
internal static partial class libc
8+
internal static partial class Sys
99
{
10-
[DllImport(Libraries.Libc, SetLastError = true)]
11-
internal static extern int close(int fd);
10+
[DllImport(Libraries.SystemNative, SetLastError = true)]
11+
internal static extern int Close(int fd);
1212
}
1313
}
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
// Copyright (c) Microsoft. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
using System;
54
using System.Runtime.InteropServices;
65

7-
using mode_t = System.Int32;
8-
96
internal static partial class Interop
107
{
11-
internal static partial class libc
8+
internal static partial class Sys
129
{
13-
[DllImport(Libraries.Libc, SetLastError = true)]
14-
internal static extern int open(string filename, OpenFlags flags, mode_t mode);
10+
[DllImport(Libraries.SystemNative, SetLastError = true)]
11+
internal static extern int Open(string filename, OpenFlags flags, int mode);
1512
}
1613
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using System;
5+
6+
internal static partial class Interop
7+
{
8+
internal static partial class Sys
9+
{
10+
[Flags]
11+
internal enum OpenFlags
12+
{
13+
// Access modes (mutually exclusive)
14+
O_RDONLY = 0x0000,
15+
O_WRONLY = 0x0001,
16+
O_RDWR = 0x0002,
17+
18+
// Flags (combineable)
19+
O_CLOEXEC = 0x0010,
20+
O_CREAT = 0x0020,
21+
O_EXCL = 0x0040,
22+
O_TRUNC = 0x0080,
23+
O_SYNC = 0x0100,
24+
}
25+
}
26+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using System.Runtime.InteropServices;
5+
6+
internal static partial class Interop
7+
{
8+
internal static partial class Sys
9+
{
10+
[DllImport(Libraries.SystemNative, SetLastError = true)]
11+
internal static extern int ShmOpen(string name, OpenFlags flags, int mode);
12+
13+
[DllImport(Libraries.SystemNative, SetLastError = true)]
14+
internal static extern int ShmUnlink(string name);
15+
}
16+
}

0 commit comments

Comments
 (0)