.\" Copyright (c) 1980, 1991, 1993, 1994 .\" The 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. .\" .\" @(#)setregid.2 8.2 (Berkeley) 4/16/94 .\" %FreeBSD: src/lib/libc/sys/setregid.2,v 1.14 2002/12/19 09:40:25 ru Exp % .\" .\" $FreeBSD$ .Dd April 16, 1994 .Dt SETREGID 2 .Os .Sh 名称 .Nm setregid .Nd 実グループ ID と実効グループ ID を設定する .Sh ライブラリ .Lb libc .Sh 書式 .In unistd.h .Ft int .Fn setregid "gid_t rgid" "gid_t egid" .Sh 解説 現在のプロセスの実グループ ID と実効グループ ID を引数で 指定されたように設定します。 実グループ ID が変更されると、退避グループ ID は新しい実効グループ ID の 値に変更されます。 .Pp 特権のないユーザは、実グループ ID をその実効グループ ID に、または 実効グループ ID をその実グループ ID に変更できます。 スーパユーザだけがその他の変更を行えます。 .Pp 実グループ ID と実効グループ ID のどちらかに値 -1 を指定すると、 システムは -1 引数の代わりに現在の ID で置き換えます。 .Pp .Fn setregid システムコールは、グループ ID 設定プログラム内の実グループ ID と 実効グループ ID を スワップし、グループ ID 設定の値を一時的に放棄できるようにするために 作られました。 このシステムコールは正しく機能せず、その目的は、今では .Xr setegid 2 システムコールを使用するとより良く達成できます。 .Pp 実グループ ID と実効グループ ID を同じ値に設定するときは、標準の .Fn setgid システムコールを使用してください。 .Sh 戻り値 .Rv -std setregid .Sh エラー .Bl -tag -width Er .It Bq Er EPERM 現在のプロセスがスーパユーザでなく、その実効グループ ID を その実グループ ID に変更する以外の変更が指定されました。 .El .Sh 関連項目 .Xr getgid 2 , .Xr issetugid 2 , .Xr setegid 2 , .Xr setgid 2 , .Xr setuid 2 .Sh 歴史 .Fn setregid システムコールは .Bx 4.2 で登場しました。