.\" Copyright (c) 1991, 1993 .\" 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. .\" .\" @(#)getgrouplist.3 8.1 (Berkeley) 6/9/93 .\" .\" $FreeBSD$ .Dd June 9, 1993 .Dt GETGROUPLIST 3 .Os .Sh 名称 .Nm getgrouplist .Nd グループアクセスリストの演算 .Sh 書式 .Fd #include .Ft int .Fn getgrouplist "const char *name" "int basegid" "int *groups" "int *ngroups" .Sh 解説 .Fn getgrouplist 関数はグループファイルを読み通して、 .Fa name で指定したユーザ のためにグループアクセスリストを演算します。グループリストには、 .Fa basegid が自動的に含まれます。通常、この値はパスワードファイルから、 グループ番号として与えられます。 .Pp 結果のグループリストは、 .Fa groups で指された整数配列で返されます。呼び出し元は .Fa ngroups に示された整数で .Fa groups 配列の大きさを指定します。見付かった グループの実際の数は、 .Fa ngroups で返ります。 .Sh 戻り値 .Fn getgrouplist 関数は、そのユーザのグループすべてを保持するには、 グループリストのサイズが小さすぎる場合、\-1 を返します。 グループ配列はこの場合、大きさに見合うだけの数のグループで満たされます。 .Sh 関連ファイル .Bl -tag -width /etc/group -compact .It Pa /etc/group グループ会員リスト .El .Sh 関連項目 .Xr setgroups 2 , .Xr initgroups 3 .Sh 歴史 .Fn getgrouplist 関数は .Bx 4.4 で最初に取り入れられました。 .Sh バグ .Fn getgrouplist 関数は、 .Xr getgrent 3 に基づくルーチンを使用します。 したがって、呼び出しプログラムがこれらのルーチンのどれかを使用すると、 .Fn getgrouplist の呼び出しによってグループ構造体が上書きされます。