Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GeneratedDllImport for blittable p/invokes in System.Console, System.IO.FileSystem.Watcher, System.IO.Pipes #61996

Merged
merged 2 commits into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/libraries/Common/src/Interop/OSX/Interop.EventStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,16 @@ internal static partial void FSEventStreamScheduleWithRunLoop(
/// Stops receiving events on the specified stream. The stream can be restarted and not miss any events.
/// </summary>
/// <param name="streamRef">The stream to stop receiving events on.</param>
[DllImport(Interop.Libraries.CoreServicesLibrary)]
internal static extern void FSEventStreamStop(IntPtr streamRef);
[GeneratedDllImport(Interop.Libraries.CoreServicesLibrary)]
internal static partial void FSEventStreamStop(IntPtr streamRef);

/// <summary>
/// Invalidates an EventStream and removes it from any RunLoops.
/// </summary>
/// <param name="streamRef">The FSEventStream to invalidate</param>
/// <remarks>This can only be called after FSEventStreamScheduleWithRunLoop has be called</remarks>
[DllImport(Interop.Libraries.CoreServicesLibrary)]
internal static extern void FSEventStreamInvalidate(IntPtr streamRef);
[GeneratedDllImport(Interop.Libraries.CoreServicesLibrary)]
internal static partial void FSEventStreamInvalidate(IntPtr streamRef);

/// <summary>
/// Removes the event stream from the RunLoop.
Expand All @@ -167,7 +167,7 @@ internal static partial void FSEventStreamUnscheduleFromRunLoop(
/// Releases a reference count on the specified EventStream and, if necessary, cleans the stream up.
/// </summary>
/// <param name="streamRef">The stream on which to decrement the reference count.</param>
[DllImport(Interop.Libraries.CoreServicesLibrary)]
internal static extern void FSEventStreamRelease(IntPtr streamRef);
[GeneratedDllImport(Interop.Libraries.CoreServicesLibrary)]
internal static partial void FSEventStreamRelease(IntPtr streamRef);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ private static partial int AppleCryptoNative_SecKeychainCreate(
byte[] utf8Passphrase,
out SafeKeychainHandle keychain);

[DllImport(Libraries.AppleCryptoNative)]
private static extern int AppleCryptoNative_SecKeychainDelete(IntPtr keychain);
[GeneratedDllImport(Libraries.AppleCryptoNative)]
private static partial int AppleCryptoNative_SecKeychainDelete(IntPtr keychain);

[GeneratedDllImport(Libraries.AppleCryptoNative)]
private static partial int AppleCryptoNative_SecKeychainCopyDefault(out SafeKeychainHandle keychain);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ internal static partial class Fcntl
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FcntlSetPipeSz", SetLastError=true)]
internal static partial int SetPipeSz(SafePipeHandle fd, int size);

[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FcntlCanGetSetPipeSz")]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FcntlCanGetSetPipeSz")]
[SuppressGCTransition]
private static extern int FcntlCanGetSetPipeSz();
private static partial int FcntlCanGetSetPipeSz();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ internal static partial class Sys
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ReadStdin", SetLastError = true)]
internal static unsafe partial int ReadStdin(byte* buffer, int bufferSize);

[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_InitializeConsoleBeforeRead")]
internal static extern void InitializeConsoleBeforeRead(byte minChars = 1, byte decisecondsTimeout = 0);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_InitializeConsoleBeforeRead")]
internal static partial void InitializeConsoleBeforeRead(byte minChars = 1, byte decisecondsTimeout = 0);

[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_UninitializeConsoleAfterRead")]
internal static extern void UninitializeConsoleAfterRead();
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_UninitializeConsoleAfterRead")]
internal static partial void UninitializeConsoleAfterRead();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal static partial class Interop
{
internal static partial class Sys
{
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SetEUid")]
internal static extern int SetEUid(uint euid);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SetEUid")]
internal static partial int SetEUid(uint euid);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ internal static partial class Interop
{
internal static partial class Sys
{
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetSignalForBreak")]
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetSignalForBreak")]
[SuppressGCTransition]
internal static extern int GetSignalForBreak();
internal static partial int GetSignalForBreak();

[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SetSignalForBreak")]
internal static extern int SetSignalForBreak(int signalForBreak);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SetSignalForBreak")]
internal static partial int SetSignalForBreak(int signalForBreak);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal static partial class Interop
{
internal static partial class Sys
{
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SetTerminalInvalidationHandler")]
internal static extern unsafe void SetTerminalInvalidationHandler(delegate* unmanaged<void> handler);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SetTerminalInvalidationHandler")]
internal static unsafe partial void SetTerminalInvalidationHandler(delegate* unmanaged<void> handler);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal static partial class Sys
/// <summary>
/// Forces a write of all modified I/O buffers to their storage mediums.
/// </summary>
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Sync")]
internal static extern void Sync();
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Sync")]
internal static partial void Sync();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ internal static partial class Interop
{
internal static partial class Crypto
{
[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_OcspRequestDestroy")]
internal static extern void OcspRequestDestroy(IntPtr ocspReq);
[GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_OcspRequestDestroy")]
internal static partial void OcspRequestDestroy(IntPtr ocspReq);

[GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetOcspRequestDerSize")]
internal static partial int GetOcspRequestDerSize(SafeOcspRequestHandle req);
Expand All @@ -31,8 +31,8 @@ ref MemoryMarshal.GetReference(buf),
buf.Length);
}

[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_OcspResponseDestroy")]
internal static extern void OcspResponseDestroy(IntPtr ocspReq);
[GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_OcspResponseDestroy")]
internal static partial void OcspResponseDestroy(IntPtr ocspReq);

[GeneratedDllImport(Libraries.CryptoNative, CharSet = CharSet.Ansi)]
private static partial int CryptoNative_X509ChainGetCachedOcspStatus(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ internal static SafePkcs7Handle DecodePkcs7(ReadOnlySpan<byte> buf) =>
[GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_Pkcs7CreateCertificateCollection")]
internal static partial SafePkcs7Handle Pkcs7CreateCertificateCollection(SafeX509StackHandle certs);

[DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_Pkcs7Destroy")]
internal static extern void Pkcs7Destroy(IntPtr p7);
[GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_Pkcs7Destroy")]
internal static partial void Pkcs7Destroy(IntPtr p7);

[GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetPkcs7Certificates")]
private static partial int GetPkcs7Certificates(SafePkcs7Handle p7, out SafeSharedX509StackHandle certs);
Expand Down