186d7f5d3SJohn Marino.\" Copyright (c) 1996 The NetBSD Foundation, Inc. 286d7f5d3SJohn Marino.\" All rights reserved. 386d7f5d3SJohn Marino.\" 486d7f5d3SJohn Marino.\" This code is derived from software contributed to The NetBSD Foundation 586d7f5d3SJohn Marino.\" by Paul Kranenburg. 686d7f5d3SJohn Marino.\" 786d7f5d3SJohn Marino.\" Redistribution and use in source and binary forms, with or without 886d7f5d3SJohn Marino.\" modification, are permitted provided that the following conditions 986d7f5d3SJohn Marino.\" are met: 1086d7f5d3SJohn Marino.\" 1. Redistributions of source code must retain the above copyright 1186d7f5d3SJohn Marino.\" notice, this list of conditions and the following disclaimer. 1286d7f5d3SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright 1386d7f5d3SJohn Marino.\" notice, this list of conditions and the following disclaimer in the 1486d7f5d3SJohn Marino.\" documentation and/or other materials provided with the distribution. 1586d7f5d3SJohn Marino.\" 3. All advertising materials mentioning features or use of this software 1686d7f5d3SJohn Marino.\" must display the following acknowledgement: 1786d7f5d3SJohn Marino.\" This product includes software developed by the NetBSD 1886d7f5d3SJohn Marino.\" Foundation, Inc. and its contributors. 1986d7f5d3SJohn Marino.\" 4. Neither the name of The NetBSD Foundation nor the names of its 2086d7f5d3SJohn Marino.\" contributors may be used to endorse or promote products derived 2186d7f5d3SJohn Marino.\" from this software without specific prior written permission. 2286d7f5d3SJohn Marino.\" 2386d7f5d3SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2486d7f5d3SJohn Marino.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2586d7f5d3SJohn Marino.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2686d7f5d3SJohn Marino.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE 2786d7f5d3SJohn Marino.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2886d7f5d3SJohn Marino.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2986d7f5d3SJohn Marino.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 3086d7f5d3SJohn Marino.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3186d7f5d3SJohn Marino.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3286d7f5d3SJohn Marino.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3386d7f5d3SJohn Marino.\" POSSIBILITY OF SUCH DAMAGE. 3486d7f5d3SJohn Marino.\" 3586d7f5d3SJohn Marino.\" $NetBSD: psignal.9,v 1.1 1996/06/22 22:57:35 pk Exp $ 3686d7f5d3SJohn Marino.\" $FreeBSD: src/share/man/man9/psignal.9,v 1.7.2.2 2001/12/17 11:30:18 ru Exp $ 3786d7f5d3SJohn Marino.\" $DragonFly: src/share/man/man9/ksignal.9,v 1.3 2007/10/06 22:36:18 swildner Exp $ 3886d7f5d3SJohn Marino.\" 3986d7f5d3SJohn Marino.Dd June 22, 1996 4086d7f5d3SJohn Marino.Dt KSIGNAL 9 4186d7f5d3SJohn Marino.Os 4286d7f5d3SJohn Marino.Sh NAME 4386d7f5d3SJohn Marino.Nm ksignal , 4486d7f5d3SJohn Marino.Nm pgsignal , 4586d7f5d3SJohn Marino.Nm gsignal 4686d7f5d3SJohn Marino.Nd post signal to a process or process group 4786d7f5d3SJohn Marino.Sh SYNOPSIS 4886d7f5d3SJohn Marino.In sys/types.h 4986d7f5d3SJohn Marino.In sys/signalvar.h 5086d7f5d3SJohn Marino.Ft void 5186d7f5d3SJohn Marino.Fn ksignal "struct proc *p" "int signum" 5286d7f5d3SJohn Marino.Ft void 5386d7f5d3SJohn Marino.Fn pgsignal "struct pgrp *pgrp" "int signum" "int checkctty" 5486d7f5d3SJohn Marino.Ft void 5586d7f5d3SJohn Marino.Fn gsignal "int pgid" "int signum" 5686d7f5d3SJohn Marino.Sh DESCRIPTION 5786d7f5d3SJohn MarinoThese functions post a signal to one or more processes. 5886d7f5d3SJohn MarinoThe argument 5986d7f5d3SJohn Marino.Fa signum 6086d7f5d3SJohn Marinocommon to all three functions should be in the range 6186d7f5d3SJohn Marino.Bq 1- Ns Dv NSIG . 6286d7f5d3SJohn Marino.Pp 6386d7f5d3SJohn MarinoThe 6486d7f5d3SJohn Marino.Fn ksignal 6586d7f5d3SJohn Marinofunction posts signal number 6686d7f5d3SJohn Marino.Fa signum 6786d7f5d3SJohn Marinoto the process represented by the process structure 6886d7f5d3SJohn Marino.Fa p . 6986d7f5d3SJohn MarinoWith a few exceptions noted below, the target process signal disposition is 7086d7f5d3SJohn Marinoupdated and is marked as runnable, so further handling of the signal is done 7186d7f5d3SJohn Marinoin the context of the target process after a context switch. 7286d7f5d3SJohn MarinoNote that 7386d7f5d3SJohn Marino.Fn ksignal 7486d7f5d3SJohn Marinodoes not by itself cause a context switch to happen. 7586d7f5d3SJohn Marino.Pp 7686d7f5d3SJohn MarinoThe target process is not marked as runnable in the following cases: 7786d7f5d3SJohn Marino.Bl -bullet -offset indent 7886d7f5d3SJohn Marino.It 7986d7f5d3SJohn MarinoThe target process is sleeping uninterruptibly. 8086d7f5d3SJohn MarinoThe signal will be 8186d7f5d3SJohn Marinonoticed when the process returns from the system call or trap. 8286d7f5d3SJohn Marino.It 8386d7f5d3SJohn MarinoThe target process is currently ignoring the signal. 8486d7f5d3SJohn Marino.It 8586d7f5d3SJohn MarinoIf a stop signal is sent to a sleeping process that takes the 8686d7f5d3SJohn Marinodefault action 8786d7f5d3SJohn Marino(see 8886d7f5d3SJohn Marino.Xr sigaction 2 ) , 8986d7f5d3SJohn Marinothe process is stopped without awakening it. 9086d7f5d3SJohn Marino.It 9186d7f5d3SJohn Marino.Dv SIGCONT 9286d7f5d3SJohn Marinorestarts a stopped process 9386d7f5d3SJohn Marino(or puts them back to sleep) 9486d7f5d3SJohn Marinoregardless of the signal action 9586d7f5d3SJohn Marino(e.g., blocked or ignored). 9686d7f5d3SJohn Marino.El 9786d7f5d3SJohn Marino.Pp 9886d7f5d3SJohn MarinoIf the target process is being traced 9986d7f5d3SJohn Marino.Fn ksignal 10086d7f5d3SJohn Marinobehaves as if the target process were taking the default action for 10186d7f5d3SJohn Marino.Fa signum . 10286d7f5d3SJohn MarinoThis allows the tracing process to be notified of the signal. 10386d7f5d3SJohn Marino.Pp 10486d7f5d3SJohn MarinoThe 10586d7f5d3SJohn Marino.Fn pgsignal 10686d7f5d3SJohn Marinofunction posts signal number 10786d7f5d3SJohn Marino.Fa signum 10886d7f5d3SJohn Marinoto each member of the process group described by 10986d7f5d3SJohn Marino.Fa pgrp . 11086d7f5d3SJohn MarinoIf 11186d7f5d3SJohn Marino.Fa checkctty 11286d7f5d3SJohn Marinois non-zero, the signal will be posted only to processes that have 11386d7f5d3SJohn Marinoa controlling terminal. 11486d7f5d3SJohn Marino.Fn pgsignal 11586d7f5d3SJohn Marinois implemented by walking along the process list headed by the field 11686d7f5d3SJohn Marino.Li pg_members 11786d7f5d3SJohn Marinoof the process group structure 11886d7f5d3SJohn Marinopointed at by 11986d7f5d3SJohn Marino.Fa pgrp 12086d7f5d3SJohn Marinoand calling 12186d7f5d3SJohn Marino.Fn ksignal 12286d7f5d3SJohn Marinoas appropriate. 12386d7f5d3SJohn MarinoIf 12486d7f5d3SJohn Marino.Fa pgrp 12586d7f5d3SJohn Marinois 12686d7f5d3SJohn Marino.Dv NULL 12786d7f5d3SJohn Marinono action is taken. 12886d7f5d3SJohn Marino.Pp 12986d7f5d3SJohn MarinoThe 13086d7f5d3SJohn Marino.Fn gsignal 13186d7f5d3SJohn Marinofunction posts signal number 13286d7f5d3SJohn Marino.Fa signum 13386d7f5d3SJohn Marinoto each member of the process group identified by the group id 13486d7f5d3SJohn Marino.Fa pgid . 13586d7f5d3SJohn Marino.Fn gsignal 13686d7f5d3SJohn Marinofirst finds the group structure associated with 13786d7f5d3SJohn Marino.Fa pgid , 13886d7f5d3SJohn Marinothen invokes 13986d7f5d3SJohn Marino.Fn pgsignal 14086d7f5d3SJohn Marinowith the argument 14186d7f5d3SJohn Marino.Fa checkctty 14286d7f5d3SJohn Marinoset to zero. 14386d7f5d3SJohn MarinoIf 14486d7f5d3SJohn Marino.Fa pgid 14586d7f5d3SJohn Marinois zero no action is taken. 14686d7f5d3SJohn Marino.Sh SEE ALSO 14786d7f5d3SJohn Marino.Xr sigaction 2 , 14886d7f5d3SJohn Marino.Xr tsleep 9 149