.\" Copyright (C) 2002 Andries Brouwer .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2003 Akihiro MOTOKI .\" all rights reserved. .\" Translated Sat Jul 19 03:06:26 JST 2003 .\" by Akihiro MOTOKI .\" .TH TCGETPGRP 3 2014\-01\-13 GNU "Linux Programmer's Manual" .SH 名前 tcgetpgrp, tcsetpgrp \- 端末のフォアグラウンドプロセスグループの 取得/設定を行う .SH 書式 \fB#include \fP .sp \fBpid_t tcgetpgrp(int \fP\fIfd\fP\fB);\fP .sp \fBint tcsetpgrp(int \fP\fIfd\fP\fB, pid_t \fP\fIpgrp\fP\fB);\fP .SH 説明 .\" The process itself may be a background process. 関数 \fBtcgetpgrp\fP() は、 \fIfd\fP に対応する端末のフォアグラウンドプロセスグループの プロセスグループ ID を返す。 \fIfd\fP で指定された端末は、呼び出しを行うプロセスの制御端末でなければならない。 .LP 関数 \fBtcsetpgrp\fP() は、プロセスグループID が \fIpgrp\fP のプロセスグループを \fIfd\fP に対応する端末のフォアグラウンドプロセスグループにする。 このとき、 \fIfd\fP は \fBtcsetpgrp\fP() を呼び出すプロセスの制御端末でなければならない。 さらに、 \fIpgrp\fP は、呼び出しを行うプロセスと同じセッションに 属する (メンバが空でない) プロセスグループでなければならない。 .LP \fBtcsetpgrp\fP() がセッションに属するバックグラウンドグループプロセスのメンバから 呼び出され、かつ呼び出しを行うプロセスが \fBSIGTTOU\fP をブロックしたり 無視したりするようになっていない場合、 \fBSIGTTOU\fP シグナルは バックグラウンドプロセスグループの全てのメンバに送られる。 .SH 返り値 \fIfd\fP が呼び出しを行ったプロセスの制御端末を参照している場合、関数 \fBtcgetpgrp\fP() は、その制御端末のフォアグラウンドプロセスグループがあれば そのプロセスグループの ID を返す。 そのようなプロセスグループがなければ、現在プロセスグループ ID として使用されていない、1より大きな何らかの値が返される。 \fIfd\fP が呼び出しを行ったプロセスの制御端末を参照していない場合、 \-1 が返され、 \fIerrno\fP が適切に設定される。 .LP 成功した場合、 \fBtcsetpgrp\fP() は 0 を返す。そうでない場合、 \-1 を返し、 \fIerrno\fP を適切に設定する。 .SH エラー .TP \fBEBADF\fP \fIfd\fP が適切なファイルディスクリプターでない。 .TP \fBEINVAL\fP \fIpgrp\fP が無効な値である。 .TP \fBENOTTY\fP 呼び出しを行ったプロセスが制御端末を持っていない、もしくは 制御端末を持っているが \fIfd\fP で参照されるものとは異なる、 \fBtcsetpgrp\fP() の場合は、 \fIfd\fP で指定された制御端末がすでに呼び出しを行ったプロセスのセッション と関係のないものになっている際にも、このエラーとなる。 .TP \fBEPERM\fP \fIpgrp\fP が有効な値だが、呼び出しを行ったプロセスと同じセッションに属する プロセスのプロセスグループ ID には該当するものがない。 .SH 属性 .SS "マルチスレッディング (pthreads(7) 参照)" 関数 \fBtcgetpgrp\fP() と \fBtcsetpgrp\fP() はスレッドセーフである。 .SH 準拠 POSIX.1\-2001. .SH 注意 この関数は \fBTIOCGPGRP\fP と \fBTIOCGSID\fP の ioctl 経由で実現されている。 .SS 歴史 これらの ioctl は 4.2BSD で登場した。 これらの関数は POSIX で考案されたものである。 .SH 関連項目 \fBsetpgid\fP(2), \fBsetsid\fP(2), \fBcredentials\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。