.\" Modified 2005-02-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2012-04-30, Akihiro MOTOKI <amotoki@gmail.com>
.\"
-.TH SETFSGID 2 2010\-11\-22 Linux "Linux Programmer's Manual"
+.TH SETFSGID 2 2013\-08\-08 Linux "Linux Programmer's Manual"
.SH 名前
setfsgid \- ファイルシステムのチェックに用いられるグループ ID を設定する
.SH 書式
-\fB#include <unistd.h>\fP /* glibc では <sys/fsuid.h> */
+\fB#include <sys/fsuid.h>\fP
.sp
\fBint setfsgid(uid_t \fP\fIfsgid\fP\fB);\fP
.SH 説明
-システムコール \fBsetfsgid\fP() は Linux カーネルがファイルシステムに対する 全てのアクセスのチェックに使用するグループ
-IDを設定する。通常は \fIfsgid\fP の値は実効 (effective) グループID と同じになる。実際、 実効グループ ID が変更される度に
-\fIfsgid\fP もまた新しい実効グループID の値に変更される。
+The system call \fBsetfsgid\fP() changes the value of the caller's filesystem
+group ID\(emthe group ID that the Linux kernel uses to check for all
+accesses to the filesystem. Normally, the value of the filesystem group ID
+will shadow the value of the effective group ID. In fact, whenever the
+effective group ID is changed, the filesystem group ID will also be changed
+to the new value of the effective group ID.
通常、 \fBsetfsuid\fP() や \fBsetfsgid\fP() を明示的に呼び出すのは、Linux NFS サーバー のように、
ファイルアクセスに用いるユーザID / グループID を変更しなければならないが、 対応する実(real)/実効(effective) ユーザID /
グループID は変更したくないような プログラムに限られる。 NFS サーバーのようなプログラムで、通常のユーザID を変更すると、
プロセスを望まないシグナルにさらす可能性があり、 セキュリティホールになる。(下記参照)
-\fBsetfsgid\fP() は、スーパーユーザによって呼び出された場合か、 \fIfsgid\fP が実グループID、実効グループID、
-保存セットグループID (saved set\-group\-ID)、現在の \fIfsgid\fP の値のいずれかに一致する場合にのみ成功する。
+\fBsetfsgid\fP() will succeed only if the caller is the superuser or if
+\fIfsgid\fP matches either the caller's real group ID, effective group ID,
+saved set\-group\-ID, or current the filesystem user ID.
.SH 返り値
-成功した場合、 \fIfsgid\fP の以前の値を返す。エラーの場合は \fIfsgid\fP の現在の値を返す。
+On both success and failure, this call returns the previous filesystem group
+ID of the caller.
.SH バージョン
.\" This system call is present since Linux 1.1.44
.\" and in libc since libc 4.7.6.
glibc が引き数がグループID として不正だと判断した場合は、 システムコールを行わず \fIerrno\fP に \fBEINVAL\fP を設定して \-1
が返される。
.LP
-このシステムコールが導入された当時、プロセスは 同じ実効ユーザIDのプロセスへシグナルを送ることができた。
-今日では、シグナル送信権限の扱いはかなり違うものになっている。
+Note that at the time this system call was introduced, a process could send
+a signal to a process with the same effective user ID. Today signal
+permission handling is slightly different. See \fBsetfsuid\fP(2) for a
+discussion of why the use of both \fBsetfsuid\fP(2) and \fBsetfsgid\fP() is
+nowadays unneeded.
元々の Linux の \fBsetfsgid\fP() システムコールは
16 ビットのグループ ID だけに対応していた。
glibc の \fBsetfsgid\fP() のラッパー関数は
カーネルバージョンによるこの違いを吸収している。
.SH バグ
-いかなる種類のエラーメッセージも返さない。 失敗した場合は (呼び出し元には \fBCAP_SETGID\fP ケーパビリティがなかったのだから) 最低でも
-\fBEPERM\fP くらいは返すべきである。
+No error indications of any kind are returned to the caller, and the fact
+that both successful and unsuccessful calls return the same value makes it
+impossible to directly determine whether the call succeeded or failed.
+Instead, the caller must resort to looking at the return value from a
+further call such as \fIsetfsgid(\-1)\fP (which will always fail), in order to
+determine if a preceding call to \fBsetfsgid\fP() changed the filesystem group
+ID. At the very least, \fBEPERM\fP should be returned when the call fails
+(because the caller lacks the \fBCAP_SETGID\fP capability).
.SH 関連項目
\fBkill\fP(2), \fBsetfsuid\fP(2), \fBcapabilities\fP(7), \fBcredentials\fP(7)
.SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.54 の一部
である。プロジェクトの説明とバグ報告に関する情報は
http://www.kernel.org/doc/man\-pages/ に書かれている。