blob: bda7bf96d5833adc143bbcda2b1ce8112ad6eebd [file] [log] [blame]
njnde62cbf2005-06-10 22:08:14 +00001
2/*--------------------------------------------------------------------*/
3/*--- Signal-related libc stuff. pub_core_libcsignal.h ---*/
4/*--------------------------------------------------------------------*/
5
6/*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
9
sewardj9ebd6e02007-01-08 06:01:59 +000010 Copyright (C) 2000-2007 Julian Seward
njnde62cbf2005-06-10 22:08:14 +000011 jseward@acm.org
12
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.
17
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.
22
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.
27
28 The GNU General Public License is contained in the file COPYING.
29*/
30
31#ifndef __PUB_CORE_LIBCSIGNAL_H
32#define __PUB_CORE_LIBCSIGNAL_H
33
34//--------------------------------------------------------------------
35// PURPOSE: This module contains all the libc code related to signals.
36//--------------------------------------------------------------------
37
38#include "pub_tool_libcsignal.h"
39
sewardjc57bc142006-04-19 19:31:46 +000040/* 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. */
44
45/* --- Signal set ops --- */
46extern Int VG_(sigfillset) ( vki_sigset_t* set );
47extern Int VG_(sigemptyset) ( vki_sigset_t* set );
48
49extern Bool VG_(isfullsigset) ( const vki_sigset_t* set );
50extern Bool VG_(isemptysigset) ( const vki_sigset_t* set );
51extern Bool VG_(iseqsigset) ( const vki_sigset_t* set1,
52 const vki_sigset_t* set2 );
53
54extern Int VG_(sigaddset) ( vki_sigset_t* set, Int signum );
55extern Int VG_(sigdelset) ( vki_sigset_t* set, Int signum );
56extern Int VG_(sigismember) ( const vki_sigset_t* set, Int signum );
57
58extern void VG_(sigaddset_from_set) ( vki_sigset_t* dst, vki_sigset_t* src );
59extern void VG_(sigdelset_from_set) ( vki_sigset_t* dst, vki_sigset_t* src );
60
61/* --- Mess with the kernel's sig state --- */
62/* VG_(sigprocmask) is in pub_tool_libcsignal.h. */
63
64extern Int VG_(sigaction) ( Int signum,
65 const struct vki_sigaction* act,
66 struct vki_sigaction* oldact );
67
sewardjc57bc142006-04-19 19:31:46 +000068extern Int VG_(kill) ( Int pid, Int signo );
69extern Int VG_(tkill) ( ThreadId tid, Int signo );
70
sewardj1383bdd2006-10-17 01:30:47 +000071/* A cut-down version of POSIX sigtimedwait: poll for pending signals
72 mentioned in the sigset_t, and if any are present, select one
73 arbitrarily, return its number (which must be > 0), and put
74 auxiliary info about it in the siginfo_t, and make it
75 not-pending-any-more. If none are pending, return zero. The _zero
76 refers to the fact that there is zero timeout, so if no signals are
77 pending it returns immediately. Perhaps a better name would be
78 'sigpoll'. Returns -1 on error, 0 if no signals pending, and n > 0
79 if signal n was selected. */
80extern Int VG_(sigtimedwait_zero)( const vki_sigset_t *, vki_siginfo_t * );
sewardjc57bc142006-04-19 19:31:46 +000081
njnde62cbf2005-06-10 22:08:14 +000082#endif // __PUB_CORE_LIBCSIGNAL_H
83
84/*--------------------------------------------------------------------*/
85/*--- end ---*/
86/*--------------------------------------------------------------------*/