drd/tests/tsan_unittest: Avoid that this test reads from uninitialized memory
[valgrind.git] / coregrind / pub_core_libcsignal.h
blob5b22905ddc1935c06b7fc2b32efccb1dc0a40557
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, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 02111-1307, USA.
28 The GNU General Public License is contained in the file COPYING.
31 #ifndef __PUB_CORE_LIBCSIGNAL_H
32 #define __PUB_CORE_LIBCSIGNAL_H
34 //--------------------------------------------------------------------
35 // PURPOSE: This module contains all the libc code related to signals.
36 //--------------------------------------------------------------------
38 #include "pub_tool_libcsignal.h"
40 /* Note that these use the vki_ (kernel) structure
41 definitions, which are different in places from those that glibc
42 defines. Since we're operating right at the kernel interface, glibc's view
43 of the world is entirely irrelevant. */
45 /* --- Signal set ops --- */
46 extern Int VG_(sigfillset) ( vki_sigset_t* set );
47 extern Int VG_(sigemptyset) ( vki_sigset_t* set );
49 extern Bool VG_(isfullsigset) ( const vki_sigset_t* set );
50 extern Bool VG_(isemptysigset) ( const vki_sigset_t* set );
51 extern Bool VG_(iseqsigset) ( const vki_sigset_t* set1,
52 const vki_sigset_t* set2 );
54 extern Int VG_(sigaddset) ( vki_sigset_t* set, Int signum );
55 /* VG_(sigdelset) is in pub_tool_libcsignal.h */
56 extern Int VG_(sigismember) ( const vki_sigset_t* set, Int signum );
58 extern void VG_(sigaddset_from_set) ( vki_sigset_t* dst, const vki_sigset_t* src );
59 extern void VG_(sigdelset_from_set) ( vki_sigset_t* dst, const vki_sigset_t* src );
60 extern void VG_(sigintersectset) ( vki_sigset_t* dst, const vki_sigset_t* src );
61 extern void VG_(sigcomplementset) ( vki_sigset_t* dst, const vki_sigset_t* src );
63 /* --- Mess with the kernel's sig state --- */
64 /* VG_(sigprocmask) is in pub_tool_libcsignal.h. */
66 extern Int VG_(sigaction) ( Int signum,
67 const vki_sigaction_toK_t* act,
68 vki_sigaction_fromK_t* oldact );
70 /* Convert a sigaction which you got from the kernel (a _fromK_t) to
71 one which you can give back to the kernel (a _toK_t). On Linux,
72 vki_sigaction_{toK,fromK}_t are identical, so this is a no-op
73 (structure copy), but on Darwin it's not a no-op. */
74 extern void VG_(convert_sigaction_fromK_to_toK)(
75 const vki_sigaction_fromK_t*, /*OUT*/vki_sigaction_toK_t*);
78 extern Int VG_(kill) ( Int pid, Int signo );
79 extern Int VG_(tkill) ( Int lwpid, Int signo );
81 /* A cut-down version of POSIX sigtimedwait: poll for pending signals
82 mentioned in the sigset_t, and if any are present, select one
83 arbitrarily, return its number (which must be > 0), and put
84 auxiliary info about it in the siginfo_t, and make it
85 not-pending-any-more. If none are pending, return zero. The _zero
86 refers to the fact that there is zero timeout, so if no signals are
87 pending it returns immediately. Perhaps a better name would be
88 'sigpoll'. Returns -1 on error, 0 if no signals pending, and n > 0
89 if signal n was selected. */
90 extern Int VG_(sigtimedwait_zero)( const vki_sigset_t *, vki_siginfo_t * );
92 #endif // __PUB_CORE_LIBCSIGNAL_H
94 /*--------------------------------------------------------------------*/
95 /*--- end ---*/
96 /*--------------------------------------------------------------------*/