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