syswrap openat2 for all linux arches
[valgrind.git] / coregrind / pub_core_libcsignal.h
blob312bae2f5d309b8232766c913d66af8337f5c66d
2 /*--------------------------------------------------------------------*/
3 /*--- Signal-related libc stuff. pub_core_libcsignal.h ---*/
4 /*--------------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright (C) 2000-2017 Julian Seward
11 jseward@acm.org
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, see <http://www.gnu.org/licenses/>.
26 The GNU General Public License is contained in the file COPYING.
29 #ifndef __PUB_CORE_LIBCSIGNAL_H
30 #define __PUB_CORE_LIBCSIGNAL_H
32 //--------------------------------------------------------------------
33 // PURPOSE: This module contains all the libc code related to signals.
34 //--------------------------------------------------------------------
36 #include "pub_tool_libcsignal.h"
38 /* Note that these use the vki_ (kernel) structure
39 definitions, which are different in places from those that glibc
40 defines. Since we're operating right at the kernel interface, glibc's view
41 of the world is entirely irrelevant. */
43 /* --- Signal set ops --- */
44 extern Int VG_(sigfillset) ( vki_sigset_t* set );
45 extern Int VG_(sigemptyset) ( vki_sigset_t* set );
47 extern Bool VG_(isfullsigset) ( const vki_sigset_t* set );
48 extern Bool VG_(isemptysigset) ( const vki_sigset_t* set );
49 extern Bool VG_(iseqsigset) ( const vki_sigset_t* set1,
50 const vki_sigset_t* set2 );
52 extern Int VG_(sigaddset) ( vki_sigset_t* set, Int signum );
53 /* VG_(sigdelset) is in pub_tool_libcsignal.h */
54 extern Int VG_(sigismember) ( const vki_sigset_t* set, Int signum );
56 extern void VG_(sigaddset_from_set) ( vki_sigset_t* dst, const vki_sigset_t* src );
57 extern void VG_(sigdelset_from_set) ( vki_sigset_t* dst, const vki_sigset_t* src );
58 extern void VG_(sigintersectset) ( vki_sigset_t* dst, const vki_sigset_t* src );
59 extern void VG_(sigcomplementset) ( vki_sigset_t* dst, const vki_sigset_t* src );
61 /* --- Mess with the kernel's sig state --- */
62 /* VG_(sigprocmask) is in pub_tool_libcsignal.h. */
64 extern Int VG_(sigaction) ( Int signum,
65 const vki_sigaction_toK_t* act,
66 vki_sigaction_fromK_t* oldact );
68 /* Convert a sigaction which you got from the kernel (a _fromK_t) to
69 one which you can give back to the kernel (a _toK_t). On Linux,
70 vki_sigaction_{toK,fromK}_t are identical, so this is a no-op
71 (structure copy), but on Darwin it's not a no-op. */
72 extern void VG_(convert_sigaction_fromK_to_toK)(
73 const vki_sigaction_fromK_t*, /*OUT*/vki_sigaction_toK_t*);
76 extern Int VG_(kill) ( Int pid, Int signo );
77 extern Int VG_(tkill) ( Int lwpid, Int signo );
79 /* A cut-down version of POSIX sigtimedwait: poll for pending signals
80 mentioned in the sigset_t, and if any are present, select one
81 arbitrarily, return its number (which must be > 0), and put
82 auxiliary info about it in the siginfo_t, and make it
83 not-pending-any-more. If none are pending, return zero. The _zero
84 refers to the fact that there is zero timeout, so if no signals are
85 pending it returns immediately. Perhaps a better name would be
86 'sigpoll'. Returns -1 on error, 0 if no signals pending, and n > 0
87 if signal n was selected. */
88 extern Int VG_(sigtimedwait_zero)( const vki_sigset_t *, vki_siginfo_t * );
90 #endif // __PUB_CORE_LIBCSIGNAL_H
92 /*--------------------------------------------------------------------*/
93 /*--- end ---*/
94 /*--------------------------------------------------------------------*/