File: LibraryImports.g.cs
Project: src\src\libraries\System.IO.Compression.Brotli\src\System.IO.Compression.Brotli.csproj (System.IO.Compression.Brotli)
// <auto-generated/>
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_ConvertErrorPlatformToPal", ExactSpelling = true)]
        internal static extern partial global::Interop.Error ConvertErrorPlatformToPal(int platformErrno);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_ConvertErrorPalToPlatform", ExactSpelling = true)]
        internal static extern partial int ConvertErrorPalToPlatform(global::Interop.Error error);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_StrErrorR", ExactSpelling = true)]
        private static unsafe extern partial byte* StrErrorR(int platformErrno, byte* buffer, int bufferSize);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static partial int Close(nint fd)
        {
            int __lastError;
            int __retVal;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke(fd);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_Close", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __fd_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeFileHandle Dup(global::Microsoft.Win32.SafeHandles.SafeFileHandle oldfd)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            nint __oldfd_native = default;
            global::Microsoft.Win32.SafeHandles.SafeFileHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeFileHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeFileHandle>.ManagedToUnmanagedIn __oldfd_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __oldfd_native__marshaller.FromManaged(oldfd);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __oldfd_native = __oldfd_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__oldfd_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __oldfd_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_Dup", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __oldfd_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static partial int FLock(global::Microsoft.Win32.SafeHandles.SafeFileHandle fd, global::Interop.Sys.LockOperations operation)
        {
            int __lastError;
            nint __fd_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeFileHandle>.ManagedToUnmanagedIn __fd_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __fd_native__marshaller.FromManaged(fd);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __fd_native = __fd_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__fd_native, operation);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __fd_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_FLock", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __fd_native, global::Interop.Sys.LockOperations __operation_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static partial int FLock(nint fd, global::Interop.Sys.LockOperations operation)
        {
            int __lastError;
            int __retVal;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke(fd, operation);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_FLock", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __fd_native, global::Interop.Sys.LockOperations __operation_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static unsafe partial void GetControlCharacters(global::Interop.Sys.ControlCharacterNames* controlCharacterNames, byte* controlCharacterValues, int controlCharacterLength, out byte posixDisableValue)
        {
            posixDisableValue = default;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (byte* __posixDisableValue_native = &posixDisableValue)
            {
                __PInvoke(controlCharacterNames, controlCharacterValues, controlCharacterLength, __posixDisableValue_native);
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_GetControlCharacters", ExactSpelling = true)]
            static extern unsafe void __PInvoke(global::Interop.Sys.ControlCharacterNames* __controlCharacterNames_native, byte* __controlCharacterValues_native, int __controlCharacterLength_native, byte* __posixDisableValue_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static partial bool IsATty(global::Microsoft.Win32.SafeHandles.SafeFileHandle fd)
        {
            int __lastError;
            nint __fd_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeFileHandle>.ManagedToUnmanagedIn __fd_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __fd_native__marshaller.FromManaged(fd);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __fd_native = __fd_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__fd_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __fd_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_IsATty", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __fd_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeFileHandle Open(string filename, global::Interop.Sys.OpenFlags flags, int mode)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            byte* __filename_native = default;
            global::Microsoft.Win32.SafeHandles.SafeFileHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeFileHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __filename_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __filename_native__marshaller.FromManaged(filename, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __filename_native = __filename_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__filename_native, flags, mode);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __filename_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_Open", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(byte* __filename_native, global::Interop.Sys.OpenFlags __flags_native, int __mode_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_Poll", ExactSpelling = true)]
        internal static unsafe extern partial global::Interop.Error Poll(global::Interop.PollEvent* pollEvents, uint eventCount, int timeout, uint* triggered);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_GetEUid", ExactSpelling = true)]
        internal static extern partial uint GetEUid();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static unsafe partial int GetPwUidR(uint uid, out global::Interop.Sys.Passwd pwd, byte* buf, int bufLen)
        {
            pwd = default;
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (global::Interop.Sys.Passwd* __pwd_native = &pwd)
            {
                __retVal = __PInvoke(uid, __pwd_native, buf, bufLen);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_GetPwUidR", ExactSpelling = true)]
            static extern unsafe int __PInvoke(uint __uid_native, global::Interop.Sys.Passwd* __pwd_native, byte* __buf_native, int __bufLen_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static unsafe partial int GetPwNamR(string name, out global::Interop.Sys.Passwd pwd, byte* buf, int bufLen)
        {
            pwd = default;
            byte* __name_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __name_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __name_native__marshaller.FromManaged(name, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.Sys.Passwd* __pwd_native = &pwd)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __name_native = __name_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__name_native, __pwd_native, buf, bufLen);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __name_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_GetPwNamR", ExactSpelling = true)]
            static extern unsafe int __PInvoke(byte* __name_native, global::Interop.Sys.Passwd* __pwd_native, byte* __buf_native, int __bufLen_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_SetTerminalInvalidationHandler", ExactSpelling = true)]
        internal static unsafe extern partial void SetTerminalInvalidationHandler(delegate* unmanaged<void> handler);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_GetSignalForBreak", ExactSpelling = true)]
        internal static extern partial int GetSignalForBreak();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_SetSignalForBreak", ExactSpelling = true)]
        internal static extern partial int SetSignalForBreak(int signalForBreak);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static unsafe partial int SNPrintF(byte* str, int size, string format, string arg1)
        {
            int __lastError;
            byte* __format_native = default;
            byte* __arg1_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __arg1_native__marshaller = new();
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __format_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __arg1_native__marshaller.FromManaged(arg1, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                __format_native__marshaller.FromManaged(format, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __arg1_native = __arg1_native__marshaller.ToUnmanaged();
                    __format_native = __format_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(str, size, __format_native, __arg1_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __arg1_native__marshaller.Free();
                __format_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_SNPrintF_1S", ExactSpelling = true)]
            static extern unsafe int __PInvoke(byte* __str_native, int __size_native, byte* __format_native, byte* __arg1_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static unsafe partial int SNPrintF(byte* str, int size, string format, int arg1)
        {
            int __lastError;
            byte* __format_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __format_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __format_native__marshaller.FromManaged(format, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __format_native = __format_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(str, size, __format_native, arg1);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __format_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_SNPrintF_1I", ExactSpelling = true)]
            static extern unsafe int __PInvoke(byte* __str_native, int __size_native, byte* __format_native, int __arg1_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static partial int FStat(global::System.Runtime.InteropServices.SafeHandle fd, out global::Interop.Sys.FileStatus output)
        {
            int __lastError;
            output = default;
            nint __fd_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Runtime.InteropServices.SafeHandle>.ManagedToUnmanagedIn __fd_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __fd_native__marshaller.FromManaged(fd);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.Sys.FileStatus* __output_native = &output)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __fd_native = __fd_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__fd_native, __output_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __fd_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_FStat", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __fd_native, global::Interop.Sys.FileStatus* __output_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static partial int Stat(string path, out global::Interop.Sys.FileStatus output)
        {
            int __lastError;
            output = default;
            byte* __path_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __path_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __path_native__marshaller.FromManaged(path, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.Sys.FileStatus* __output_native = &output)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __path_native = __path_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__path_native, __output_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __path_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_Stat", ExactSpelling = true)]
            static extern unsafe int __PInvoke(byte* __path_native, global::Interop.Sys.FileStatus* __output_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static partial int LStat(string path, out global::Interop.Sys.FileStatus output)
        {
            int __lastError;
            output = default;
            byte* __path_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __path_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __path_native__marshaller.FromManaged(path, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.Sys.FileStatus* __output_native = &output)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __path_native = __path_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__path_native, __output_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __path_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_LStat", ExactSpelling = true)]
            static extern unsafe int __PInvoke(byte* __path_native, global::Interop.Sys.FileStatus* __output_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static unsafe partial int Read(global::System.Runtime.InteropServices.SafeHandle fd, byte* buffer, int count)
        {
            int __lastError;
            nint __fd_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Runtime.InteropServices.SafeHandle>.ManagedToUnmanagedIn __fd_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __fd_native__marshaller.FromManaged(fd);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __fd_native = __fd_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__fd_native, buffer, count);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __fd_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_Read", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __fd_native, byte* __buffer_native, int __count_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static unsafe partial int Write(global::System.Runtime.InteropServices.SafeHandle fd, byte* buffer, int bufferSize)
        {
            int __lastError;
            nint __fd_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Runtime.InteropServices.SafeHandle>.ManagedToUnmanagedIn __fd_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __fd_native__marshaller.FromManaged(fd);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __fd_native = __fd_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__fd_native, buffer, bufferSize);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __fd_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_Write", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __fd_native, byte* __buffer_native, int __bufferSize_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static unsafe partial int Write(nint fd, byte* buffer, int bufferSize)
        {
            int __lastError;
            int __retVal;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke(fd, buffer, bufferSize);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_Write", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __fd_native, byte* __buffer_native, int __bufferSize_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static partial int GetWindowSize(global::Microsoft.Win32.SafeHandles.SafeFileHandle terminalHandle, out global::Interop.Sys.WinSize winSize)
        {
            int __lastError;
            winSize = default;
            nint __terminalHandle_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeFileHandle>.ManagedToUnmanagedIn __terminalHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __terminalHandle_native__marshaller.FromManaged(terminalHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.Sys.WinSize* __winSize_native = &winSize)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __terminalHandle_native = __terminalHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__terminalHandle_native, __winSize_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __terminalHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_GetWindowSize", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __terminalHandle_native, global::Interop.Sys.WinSize* __winSize_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static partial bool InitializeTerminalAndSignalHandling()
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke();
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_InitializeTerminalAndSignalHandling", ExactSpelling = true)]
            static extern unsafe int __PInvoke();
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static partial void SetKeypadXmit(global::Microsoft.Win32.SafeHandles.SafeFileHandle terminalHandle, string terminfoString)
        {
            nint __terminalHandle_native = default;
            byte* __terminfoString_native = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn __terminfoString_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeFileHandle>.ManagedToUnmanagedIn __terminalHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __terminfoString_native__marshaller.FromManaged(terminfoString, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.Utf8StringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                __terminalHandle_native__marshaller.FromManaged(terminalHandle);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __terminfoString_native = __terminfoString_native__marshaller.ToUnmanaged();
                    __terminalHandle_native = __terminalHandle_native__marshaller.ToUnmanaged();
                    __PInvoke(__terminalHandle_native, __terminfoString_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __terminfoString_native__marshaller.Free();
                __terminalHandle_native__marshaller.Free();
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_SetKeypadXmit", ExactSpelling = true)]
            static extern unsafe void __PInvoke(nint __terminalHandle_native, byte* __terminfoString_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_UninitializeTerminal", ExactSpelling = true)]
        internal static extern partial void UninitializeTerminal();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static unsafe partial int ReadStdin(byte* buffer, int bufferSize)
        {
            int __lastError;
            int __retVal;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke(buffer, bufferSize);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_ReadStdin", ExactSpelling = true)]
            static extern unsafe int __PInvoke(byte* __buffer_native, int __bufferSize_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_InitializeConsoleBeforeRead", ExactSpelling = true)]
        internal static extern partial void InitializeConsoleBeforeRead(byte minChars, byte decisecondsTimeout);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_UninitializeConsoleAfterRead", ExactSpelling = true)]
        internal static extern partial void UninitializeConsoleAfterRead();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Sys
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "42.42.42.42")]
        internal static partial bool StdinReady()
        {
            bool __retVal;
            int __retVal_native;
            {
                __retVal_native = __PInvoke();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("libSystem.Native", EntryPoint = "SystemNative_StdinReady", ExactSpelling = true)]
            static extern unsafe int __PInvoke();
        }
    }
}