]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/blob - share/man/man9/psignal.9
MFC r362623:
[FreeBSD/stable/8.git] / share / man / man9 / psignal.9
1 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
2 .\" All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to The NetBSD Foundation
5 .\" by Paul Kranenburg.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\"    must display the following acknowledgement:
17 .\"        This product includes software developed by the NetBSD
18 .\"        Foundation, Inc. and its contributors.
19 .\" 4. Neither the name of The NetBSD Foundation nor the names of its
20 .\"    contributors may be used to endorse or promote products derived
21 .\"    from this software without specific prior written permission.
22 .\"
23 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
24 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
27 .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 .\" POSSIBILITY OF SUCH DAMAGE.
34 .\"
35 .\"     $NetBSD: psignal.9,v 1.1 1996/06/22 22:57:35 pk Exp $
36 .\" $FreeBSD$
37 .\"
38 .Dd October 8, 2011
39 .Dt PSIGNAL 9
40 .Os
41 .Sh NAME
42 .Nm psignal ,
43 .Nm pgsignal ,
44 .Nm gsignal ,
45 .Nm tdsignal
46 .Nd post signal to a thread, process, or process group
47 .Sh SYNOPSIS
48 .In sys/types.h
49 .In sys/signalvar.h
50 .Ft void
51 .Fn psignal "struct proc *p" "int signum"
52 .Ft void
53 .Fn pgsignal "struct pgrp *pgrp" "int signum" "int checkctty"
54 .Ft void
55 .Fn gsignal "int pgid" "int signum"
56 .Ft void
57 .Fn tdsignal "struct thread *td" "int signum"
58 .Sh DESCRIPTION
59 These functions post a signal to a thread or one or more processes.
60 The argument
61 .Fa signum
62 common to all three functions should be in the range
63 .Bq 1- Ns Dv NSIG .
64 .Pp
65 The
66 .Fn psignal
67 function posts signal number
68 .Fa signum
69 to the process represented by the process structure
70 .Fa p .
71 With a few exceptions noted below, the target process signal disposition is
72 updated and is marked as runnable, so further handling of the signal is done
73 in the context of the target process after a context switch.
74 Note that
75 .Fn psignal
76 does not by itself cause a context switch to happen.
77 .Pp
78 The target process is not marked as runnable in the following cases:
79 .Bl -bullet -offset indent
80 .It
81 The target process is sleeping uninterruptibly.
82 The signal will be
83 noticed when the process returns from the system call or trap.
84 .It
85 The target process is currently ignoring the signal.
86 .It
87 If a stop signal is sent to a sleeping process that takes the
88 default action
89 (see
90 .Xr sigaction 2 ) ,
91 the process is stopped without awakening it.
92 .It
93 .Dv SIGCONT
94 restarts a stopped process
95 (or puts them back to sleep)
96 regardless of the signal action
97 (e.g., blocked or ignored).
98 .El
99 .Pp
100 If the target process is being traced
101 .Fn psignal
102 behaves as if the target process were taking the default action for
103 .Fa signum .
104 This allows the tracing process to be notified of the signal.
105 .Pp
106 The
107 .Fn pgsignal
108 function posts signal number
109 .Fa signum
110 to each member of the process group described by
111 .Fa pgrp .
112 If
113 .Fa checkctty
114 is non-zero, the signal will be posted only to processes that have
115 a controlling terminal.
116 .Fn pgsignal
117 is implemented by walking along the process list headed by the field
118 .Li pg_members
119 of the process group structure
120 pointed at by
121 .Fa pgrp
122 and calling
123 .Fn psignal
124 as appropriate.
125 If
126 .Fa pgrp
127 is
128 .Dv NULL
129 no action is taken.
130 .Pp
131 The
132 .Fn gsignal
133 function posts signal number
134 .Fa signum
135 to each member of the process group identified by the group id
136 .Fa pgid .
137 .Fn gsignal
138 first finds the group structure associated with
139 .Fa pgid ,
140 then invokes
141 .Fn pgsignal
142 with the argument
143 .Fa checkctty
144 set to zero.
145 If
146 .Fa pgid
147 is zero no action is taken.
148 .Pp
149 The
150 .Fn tdsignal
151 function posts signal number
152 .Fa signum
153 to the thread represented by the thread structure
154 .Fa td .
155 .Sh SEE ALSO
156 .Xr sigaction 2 ,
157 .Xr signal 9 ,
158 .Xr tsleep 9