diff options
author | Aleksey Kliger (λgeek) <alklig@microsoft.com> | 2021-04-17 17:59:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-17 17:59:20 +0300 |
commit | 9174bbeb7e1e4d3dc51f4f82243cbf4c62c61efa (patch) | |
tree | 9bfb9c9896d23994cf83987b46fff432c06aaa21 | |
parent | 38e9a9317c2cf78611506c491cf27c5fddf9828c (diff) | |
parent | e86f4b3728da42a4f6df76973d9c4036c608d763 (diff) |
Merge pull request #410 from lambdageek/readdir-errno
[System.Native] Exclude ReadDir pinvoke wrappers on Mono; handle EINTR
-rw-r--r-- | src/Common/src/CoreLib/Interop/Unix/System.Native/Interop.ReadDir.cs | 11 | ||||
-rw-r--r-- | src/Native/Unix/System.Native/pal_io.c | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/Common/src/CoreLib/Interop/Unix/System.Native/Interop.ReadDir.cs b/src/Common/src/CoreLib/Interop/Unix/System.Native/Interop.ReadDir.cs index 5888c80fbc..f07012dd36 100644 --- a/src/Common/src/CoreLib/Interop/Unix/System.Native/Interop.ReadDir.cs +++ b/src/Common/src/CoreLib/Interop/Unix/System.Native/Interop.ReadDir.cs @@ -53,16 +53,19 @@ internal static partial class Interop } } - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_OpenDir", SetLastError = true)] - internal static extern IntPtr OpenDir(string path); - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetReadDirRBufferSize", SetLastError = false)] internal static extern int GetReadDirRBufferSize(); + +#if !MONO + [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_OpenDir", SetLastError = true)] + internal static extern IntPtr OpenDir(string path); + [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ReadDirR", SetLastError = false)] internal static extern unsafe int ReadDirR(IntPtr dir, byte* buffer, int bufferSize, out DirectoryEntry outputEntry); [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_CloseDir", SetLastError = true)] internal static extern int CloseDir(IntPtr dir); +#endif } -}
\ No newline at end of file +} diff --git a/src/Native/Unix/System.Native/pal_io.c b/src/Native/Unix/System.Native/pal_io.c index ddd56b91c9..de4364f4a6 100644 --- a/src/Native/Unix/System.Native/pal_io.c +++ b/src/Native/Unix/System.Native/pal_io.c @@ -455,7 +455,7 @@ int32_t SystemNative_ReadDirR(DIR* dir, uint8_t* buffer, int32_t bufferSize, str // kernel set errno -> failure if (errno != 0) { - assert_err(errno == EBADF, "Invalid directory stream descriptor dir", errno); + assert_err(errno == EBADF || errno == EINTR, "Invalid directory stream descriptor dir", errno); return errno; } return -1; |