Repository: PowerShell/PowerShell
File: src/System.Management.Automation/CoreCLR/CorePsPlatform.cs (C#)

Code before:
                // C bools are 1 byte and so must be marshalled as I1

                [LibraryImport(psLib)]
                internal static partial int GetErrorCategory(int errno);

                [LibraryImport(psLib)]
                internal static partial int GetPPid(int pid);

                [LibraryImport(psLib, StringMarshalling = StringMarshalling.Utf8, SetLastError = true)]
                internal static partial int GetLinkCount(string filePath, out int linkCount);

                [LibraryImport(psLib, StringMarshalling = StringMarshalling.Utf8)]
                [return: MarshalAs(UnmanagedType.I1)]
                internal static partial bool IsExecutable(string filePath);

                [LibraryImport(psLib)]
                internal static partial uint GetCurrentThreadId();

                [LibraryImport(psLib)]
                [return: MarshalAs(UnmanagedType.Bool)]
                internal static partial bool KillProcess(int pid);

                [LibraryImport(psLib)]
                internal static partial int WaitPid(int pid, [MarshalAs(UnmanagedType.Bool)] bool nohang);

                // This is the struct `private_tm` from setdate.h in libpsl-native.
                // https://github.com/PowerShell/PowerShell-Native/blob/c5575ceb064e60355b9fee33eabae6c6d2708d14/src/libpsl-native/src/setdate.h#L23
                [StructLayout(LayoutKind.Sequential, Pack = 4)]
                internal unsafe struct UnixTm
                {
                    /// <summary>Seconds (0-60).</summary>
                    internal int tm_sec;

                    /// <summary>Minutes (0-59).</summary>
                    internal int tm_min;

                    /// <summary>Hours (0-23).</summary>
                    internal int tm_hour;

                    /// <summary>Day of the month (1-31).</summary>
                    internal int tm_mday;

                    /// <summary>Month (0-11).</summary>
                    internal int tm_mon;

                    /// <summary>The year - 1900.</summary>
                    internal int tm_year;

                    /// <summary>Day of the week (0-6, Sunday = 0).</summary>
                    internal int tm_wday;


Review comment (suggestion):
```suggestion
                // This is the struct `private_tm` from setdate.h in libpsl-native.
                // Packing is set to 4 to match the unmanaged declaration.
```

Code after:
                // C bools are 1 byte and so must be marshalled as I1

                [LibraryImport(psLib)]
                internal static partial int GetErrorCategory(int errno);

                [LibraryImport(psLib)]
                internal static partial int GetPPid(int pid);

                [LibraryImport(psLib, StringMarshalling = StringMarshalling.Utf8, SetLastError = true)]
                internal static partial int GetLinkCount(string filePath, out int linkCount);

                [LibraryImport(psLib, StringMarshalling = StringMarshalling.Utf8)]
                [return: MarshalAs(UnmanagedType.I1)]
                internal static partial bool IsExecutable(string filePath);

                [LibraryImport(psLib)]
                internal static partial uint GetCurrentThreadId();

                [LibraryImport(psLib)]
                [return: MarshalAs(UnmanagedType.Bool)]
                internal static partial bool KillProcess(int pid);

                [LibraryImport(psLib)]
                internal static partial int WaitPid(int pid, [MarshalAs(UnmanagedType.Bool)] bool nohang);

                // This is the struct `private_tm` from setdate.h in libpsl-native.
                // Packing is set to 4 to match the unmanaged declaration.
                // https://github.com/PowerShell/PowerShell-Native/blob/c5575ceb064e60355b9fee33eabae6c6d2708d14/src/libpsl-native/src/setdate.h#L23
                [StructLayout(LayoutKind.Sequential, Pack = 4)]
                internal unsafe struct UnixTm
                {
                    /// <summary>Seconds (0-60).</summary>
                    internal int tm_sec;

                    /// <summary>Minutes (0-59).</summary>
                    internal int tm_min;

                    /// <summary>Hours (0-23).</summary>
                    internal int tm_hour;

                    /// <summary>Day of the month (1-31).</summary>
                    internal int tm_mday;

                    /// <summary>Month (0-11).</summary>
                    internal int tm_mon;

                    /// <summary>The year - 1900.</summary>
                    internal int tm_year;

                    /// <summary>Day of the week (0-6, Sunday = 0).</summary>
                    internal int tm_wday;