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