-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Implement PosixSignal API #54136
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
Merged
Merged
Implement PosixSignal API #54136
Changes from all commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
11a94bb
Implement PosixSignal API
tmds ae4d67e
PosixSignalRegistration: implement finalizer
tmds 72a2475
Support using positive PosixSignal values as raw signal numbers
tmds 17045d8
Reduce nr of TargetFrameworks
tmds 61a0fba
#ifdef SIGRTMAX
tmds b5ae07a
Don't throw Win32Exception (for now)
tmds 52e1f17
Rename PosixSignalRegistration.cs to PosixSignalRegistration.Unsuppor…
tmds 26f22b3
Spawn new Thread only for specific signals
tmds 0bd03f9
Add PosixSignal.SIGCONT, SIGWINCH, SIGTTIN, SIGTTOU, SIGTSTP
tmds e8d01c8
SystemNative_DefaultSignalHandler: remove SuppressGCTransition attribute
tmds 6cc2d89
Update comment in SystemNative_InitializeTerminalAndSignalHandling
tmds 5892f0d
Run original handler except for cancelable signals.
tmds f337677
Cleanup ControlCHandlerRegistrar
tmds c3dce04
Handle TryGetTarget returning false due to finalized PosixSignalRegis…
tmds db75bba
Use Thread.UnsafeStart
tmds 96ded59
Remove SuppressGCTransition from methods that take a lock
tmds 55f1abe
Support canceling terminal configuration on SIGCHLD/SIGCONT
tmds 7a2594c
Throw for errno using Interop.CheckIO
tmds 9c27d6e
Rename DefaultSignalHandler to HandleNonCanceledPosixSignal
tmds b5ed74d
Register Console SIGTTOU with SA_RESETHAND
tmds 76b8704
Allocate storage for tracking signals dynamically
tmds 5f5deb3
Propagate sigaction errors when enabling PosixSignal
tmds 03c03b8
Add some tests
tmds 6f0c69b
Fix entrypoints
tmds d873120
Fix compilation
tmds bc1590c
Add some more tests
tmds e8827ce
Move tests to PosixSignalRegistrationTests.Unix file
tmds 511f604
Add SignalCanCancelTermination test
tmds 1d15e42
ConfigureTerminalForChildProcesses: split Unix and iOS
tmds a760612
Fix iOS compilation failure
tmds dddc5bc
Skip signals that cause xunit to exit with non zero
tmds d4c8e24
Try fix Android compilation
tmds 12150ab
Remove SIGSTOP from UninstallableSignalsThrow because it doesn't thro…
tmds 469b6fe
Cleanup
tmds 38a4d76
Handle case where all handlers got disposed by the time we want to ca…
tmds 8841d41
GenerateReferenceAssemblySource
tmds c2ef9eb
Replace PosixSignalRegistration.Unsupported with .Windows/.Browser file
tmds 575dd7d
Remove assert(g_hasTty) from UninitializeTerminal
tmds 3756ac2
Initialize signal handling when ifndef HAS_CONSOLE_SIGNALS
tmds 778350f
Fix broken Cancel
tmds ed39929
Use SIGRTMAX as highest usable signal number.
tmds 3c02835
SIGRTMAX is not defined on all platforms, fall back to NSIG
tmds 8ccfd3e
Resend signal only when restored to SIG_DFL
tmds 481f40e
SignalCanCancelTermination test: increase timeout
tmds 669e09f
Increase timeout to 10min
tmds 2cb8cda
Update expected SIGQUIT exit code for mono
tmds 459f3e6
Change isMono check
tmds 834350f
Use PlatformDetection.IsMonoRuntime
tmds c8cb449
Add IsSignalThatTerminates method
tmds cba68f3
Add some documentation xml
tmds 19d30d6
Console.ManualTests: test terminal echo during and after child proces…
tmds e4cef47
Maintain flags and mask of original handler
tmds aa549a3
PR feedback
tmds 324db13
SystemNative_HandleNonCanceledPosixSignal: update handling based on d…
tmds 8e830fe
Apply suggestions from code review
tmds 85439d6
Don't call sa_sigaction/sa_handler twice from SystemNative_HandleNonC…
tmds b8a0b5d
Don't remove WeakReferences while iterating.
tmds 18b7139
Move static fields to the top of the class
tmds d136c5b
Remove -Wcast-qual ignore
tmds be93c17
PosixSignalContext: add XML docs
tmds 4de318a
Fix Android compilation
tmds 6898402
Fix Android compilation, take II
tmds b8234bd
Fix comment
tmds f1aee19
Add PosixSignalContext constructor test
tmds 005cddd
SystemNative_HandleNonCanceledPosixSignal: add SIG_IGN case
tmds File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/libraries/Common/src/Interop/Unix/System.Native/Interop.PosixSignal.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Runtime.InteropServices; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class Sys | ||
{ | ||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SetPosixSignalHandler")] | ||
[SuppressGCTransition] | ||
internal static extern unsafe void SetPosixSignalHandler(delegate* unmanaged<int, PosixSignal, int> handler); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_EnablePosixSignalHandling", SetLastError = true)] | ||
internal static extern bool EnablePosixSignalHandling(int signal); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_DisablePosixSignalHandling")] | ||
internal static extern void DisablePosixSignalHandling(int signal); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_HandleNonCanceledPosixSignal")] | ||
internal static extern bool HandleNonCanceledPosixSignal(int signal, int handlersDisposed); | ||
|
||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPlatformSignalNumber")] | ||
[SuppressGCTransition] | ||
tmds marked this conversation as resolved.
Show resolved
Hide resolved
|
||
internal static extern int GetPlatformSignalNumber(PosixSignal signal); | ||
} | ||
} |
24 changes: 0 additions & 24 deletions
24
src/libraries/Common/src/Interop/Unix/System.Native/Interop.RegisterForCtrlC.cs
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.