blob: 6b0882c0413e1d12a6c57f744c16ec084b41b657 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#pragma once
#include "pal_compiler.h"
#include "pal_types.h"
/**
* Initializes the signal handling, called by InitializeTerminalAndSignalHandling.
*
* Returns 1 on success; otherwise returns 0 and sets errno.
*/
int32_t InitializeSignalHandlingCore(void);
/**
* Hooks up the specified callback for notifications when SIGINT or SIGQUIT is received.
*
* Not thread safe. Caller must provide its owns synchronization to ensure RegisterForCtrl
* is not called concurrently with itself or with UnregisterForCtrl.
*
* Should only be called when a callback is not currently registered.
*/
PALEXPORT void SystemNative_RegisterForCtrl(CtrlCallback callback);
/**
* Unregisters the previously registered ctrlCCallback.
*
* Not thread safe. Caller must provide its owns synchronization to ensure UnregisterForCtrl
* is not called concurrently with itself or with RegisterForCtrl.
*
* Should only be called when a callback is currently registered. The pointer
* previously registered must remain valid until all ctrl handling activity
* has quiesced.
*/
PALEXPORT void SystemNative_UnregisterForCtrl(void);
typedef void (*SigChldCallback)(int reapAll);
/**
* Hooks up the specified callback for notifications when SIGCHLD is received.
*
* Should only be called when a callback is not currently registered.
*/
PALEXPORT void SystemNative_RegisterForSigChld(SigChldCallback callback);
/**
* Remove our handler and reissue the signal to be picked up by the previously registered handler.
*
* In the most common case, this will be the default handler, causing the process to be torn down.
* It could also be a custom handler registered by other code before us.
*/
PALEXPORT void SystemNative_RestoreAndHandleCtrl(CtrlCode ctrlCode);
typedef void (*TerminalInvalidationCallback)(void);
/**
* Hooks up the specified callback for notifications when SIGCHLD, SIGCONT, SIGWINCH are received.
*
*/
PALEXPORT void SystemNative_SetTerminalInvalidationHandler(TerminalInvalidationCallback callback);
#ifndef HAS_CONSOLE_SIGNALS
/**
* Initializes signal handling and terminal for use by System.Console and System.Diagnostics.Process.
*
* Returns 1 on success; otherwise returns 0 and sets errno.
*/
PALEXPORT int32_t SystemNative_InitializeTerminalAndSignalHandling(void);
#endif
|