.\" Copyright (c) 1980, 1991 Regents of the University of California. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)killpg.2 6.5 (Berkeley) 3/10/91 .\" .\" Modified Fri Jul 23 21:55:01 1993 by Rik Faith .\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond .\" Modified 2004-06-16 by Michael Kerrisk .\" Added notes on CAP_KILL .\" Modified 2004-06-21 by aeb .\" .\" Japanese Version Copyright (c) 1997 Kazuyuki Tanisako .\" all rights reserved. .\" Translated Sat May 17 14:10:42 JST 1997 .\" by Kazuyuki Tanisako .\" Updated & Modified Sat Feb 5 21:24:32 JST 2005 .\" by Yuichi SATO .\" .\"WORD: process group プロセス・グループ .\"WORD: signal シグナル .\"WORD: effective user ID 実効ユーザーID .\"WORD: super-user スーパー・ユーザー .\" .TH KILLPG 2 2010-09-20 "Linux" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O killpg \- send signal to a process group killpg \- シグナルをプロセス・グループに送る .\"O .SH SYNOPSIS .SH 書式 .B #include .sp .BI "int killpg(int " pgrp ", int " sig ); .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .ad l .TP 4 .BR killpg (): _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED .ad .\"O .SH DESCRIPTION .SH 説明 .\"O .BR killpg () .\"O sends the signal .\"O .I sig .\"O to the process group .\"O .IR pgrp . .BR killpg () は .I sig で指定したシグナルを .I pgrp で指定したプロセス・グループに送る。 シグナルの定義の一覧は .\"O See .\"O .BR signal (7) .\"O for a list of signals. .BR signal (7) を参照のこと。 .\"O If .\"O .I pgrp .\"O is 0, .\"O .BR killpg () .\"O sends the signal to the sending process's process group. .\"O sends the signal to the calling process's process group. 引き数 .I pgrp に 0 を指定した場合には .BR killpg () は呼び出し元のプロセスが属しているプロセス・グループに対してシグナルを送る。 .\"O (POSIX says: If .\"O .I pgrp .\"O is less than or equal to 1, the behavior is undefined.) (POSIX では以下のように記述されている: .I pgrp が 1 以下である場合、動作は未定義である。) .\"O For a process to have permission to send a signal .\"O it must either be privileged (under Linux: have the .\"O .B CAP_KILL .\"O capability), or the real or effective .\"O user ID of the sending process must equal the real or .\"O saved set-user-ID of the target process. プロセスがシグナルを送信する許可を持つためには、 プロセスが特権 (Linux では .B CAP_KILL ケーパビリティ (capability)) を持つか、 送信元プロセスの実ユーザー ID または実効ユーザー ID が 送信先プロセスの実 set-user-ID または保存 set-user-ID と 等しくなければならない。 .\"O In the case of .\"O .B SIGCONT .\"O it suffices when the sending and receiving .\"O processes belong to the same session. .B SIGCONT の場合、送信プロセスと受信プロセスが 同じセッションに属していれば十分である。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O On success, zero is returned. .\"O On error, \-1 is returned, and .\"O .I errno .\"O is set appropriately. 正常終了すると 0 が返り値となる。異常終了の場合 \-1 が返り値となり .I errno に原因コードが設定される。 .\"O .SH ERRORS .SH エラー .TP .B EINVAL .\"O .I Sig .\"O is not a valid signal number. .I sig で指定された値は無効なシグナル番号である。 .TP .B EPERM .\"O The process does not have permission to send the signal .\"O to any of the target processes. プロセスに何れかの送信先プロセスにシグナルを送信する許可がない。 .TP .B ESRCH .\"O No process can be found in the process group specified by .\"O .IR pgrp . .I pgrp で指定されたプロセス・グループに属するプロセスが存在しなかった。 .TP .B ESRCH .\"O The process group was given as 0 but the sending process does not .\"O have a process group. プロセス・グループとして 0 が指定されたが、送信プロセスは プロセス・グループを持っていない。 .\"O .SH "CONFORMING TO" .SH 準拠 .\"O SVr4, 4.4BSD (the .\"O .BR killpg () .\"O function call first appeared in 4BSD), POSIX.1-2001. SVr4, 4.4BSD .RB ( killpg () は 4BSD で初めて追加された), POSIX.1-2001。 .\"O .SH NOTES .SH 注意 .\"O There are various differences between the permission checking .\"O in BSD-type systems and System V-type systems. .\"O See the POSIX rationale for .\"O .BR kill (). .\"O A difference not mentioned by POSIX concerns the return .\"O value .\"O .BR EPERM : .\"O BSD documents that no signal is sent and .\"O .B EPERM .\"O returned when the permission check failed for at least one target process, .\"O while POSIX documents .\"O .B EPERM .\"O only when the permission check failed for all target processes. BSD 系システムと System V 系システムでは、 許可のチェックに様々な違いがある。 .BR kill (2) についての POSIX の原理 (rationale) を参照すること。 POSIX で記述されていない違いとしては、返り値 .B EPERM がある。 BSD では「送信先プロセスの許可のチェックが 1 つでも失敗した場合は、 シグナルが送信されず、 .B EPERM が返される」と記述されている。 POSIX では「送信先プロセスの許可のチェックが全て失敗した場合にのみ、 .B EPERM が返される」と記述されている。 .\"O On Linux, .\"O .BR killpg () .\"O is implemented as a library function that makes the call .\"O .IR "kill(-pgrp,\ sig)" . Linux では、 .BR killpg () はライブラリ関数として実装されており、 .I "kill(-pgrp,\ sig)" の呼び出しが行われる。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR getpgrp (2), .BR kill (2), .BR signal (2), .BR credentials (7), .BR capabilities (7)