Exemplo n.º 1
0
        // The calling pattern for ReadDir is described in src/Native/System.Native/pal_readdir.cpp
        internal static int ReadDir(SafeDirectoryHandle dir, out DirectoryEntry outputEntry)
        {
            unsafe
            {
                // To reduce strcpys, alloc a buffer here and get the result from OS, then copy it over for the caller.
                byte* buffer = stackalloc byte[s_direntSize];
                InternalDirectoryEntry temp;
                int ret = ReadDirR(dir, buffer, s_direntSize, out temp);
                outputEntry = ret == 0 ?
                            new DirectoryEntry() { InodeName = GetDirectoryEntryName(temp), InodeType = temp.InodeType } : 
                            default(DirectoryEntry);

                return ret;
            }
        }
Exemplo n.º 2
0
 private static unsafe extern int ReadDirR(SafeDirectoryHandle dir, byte* buffer, int bufferSize, out InternalDirectoryEntry outputEntry);