.\"
.TH GETGROUPLIST 3 2009-07-03 "GNU" "Linux Programmer's Manual"
.\"O .SH NAME
-.SH ̾Á°
+.SH 名前
.\"O getgrouplist \- get list of groups to which a user belongs
-getgrouplist \- ¥æ¡¼¥¶¤¬½ê°¤¹¤ë¥°¥ë¡¼¥×¤Î¥ê¥¹¥È¤ò¼èÆÀ¤¹¤ë
+getgrouplist \- ユーザが所属するグループのリストを取得する
.\"O .SH SYNOPSIS
-.SH ½ñ¼°
+.SH 書式
.B #include <grp.h>
.sp
.BI "int getgrouplist(const char *" user ", gid_t " group ,
.in -4n
.\"O Feature Test Macro Requirements for glibc (see
.\"O .BR feature_test_macros (7)):
-glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
+glibc 向けの機能検査マクロの要件
.RB ( feature_test_macros (7)
-»²¾È):
+参照):
.in
.sp
.BR getgrouplist ():
_BSD_SOURCE
.\"O .SH DESCRIPTION
-.SH ÀâÌÀ
+.SH 説明
.\"O The
.\"O .BR getgrouplist ()
.\"O function scans the group database (see
.\"O of these groups are returned in the array
.\"O .IR groups .
.BR getgrouplist ()
-´Ø¿ô¤Ï¡¢¥°¥ë¡¼¥×¥Ç¡¼¥¿¥Ù¡¼¥¹
+é\96¢æ\95°ã\81¯ã\80\81ã\82°ã\83«ã\83¼ã\83\97ã\83\87ã\83¼ã\82¿ã\83\99ã\83¼ã\82¹
.RB ( group (5)
-»²¾È) ¤òÄ´¤Ù¤Æ¡¢
+参照) を調べて、
.I user
-¤¬½ê°¤¹¤ë¥°¥ë¡¼¥×¤Î¥ê¥¹¥È¤ò¼èÆÀ¤¹¤ë¡£
-¸«¤Ä¤«¤Ã¤¿¥°¥ë¡¼¥×¤Î¤¦¤ÁºÇÂç
+が所属するグループのリストを取得する。
+見つかったグループのうち最大
.I *ngroups
-¸Ä¤Î¥°¥ë¡¼¥×¤¬¡¢ÇÛÎó
+個のグループが、配列
.I groups
-¤Ë³ÊǼ¤µ¤ì¤ÆÊÖ¤µ¤ì¤ë¡£
+に格納されて返される。
.\"O If it was not among the groups defined for
.\"O .I user
.\"O typically this argument is specified as the group ID from
.\"O the password record for
.\"O .IR user .
-°ú¤¿ô
+引き数
.I group
-¤¬¥°¥ë¡¼¥×¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë
+がグループデータベースに
.I user
-¤¬½ê°¤¹¤ë¥°¥ë¡¼¥×¤¬¤Ê¤«¤Ã¤¿¾ì¹ç¡¢
+が所属するグループがなかった場合、
.BR getgrouplist ()
-¤¬ÊÖ¤¹¥°¥ë¡¼¥×¤Î¥ê¥¹¥È¤Ë°ú¤¿ô
+が返すグループのリストに引き数
.I group
-¤âÄɲ䵤ì¤ë¡£
-Ä̾ï¤Ï¡¢¤³¤Î°ú¤¿ô¤Ë¤Ï¥æ¡¼¥¶
+も追加される。
+é\80\9a常ã\81¯ã\80\81ã\81\93ã\81®å¼\95ã\81\8dæ\95°ã\81«ã\81¯ã\83¦ã\83¼ã\82¶
.I user
-¤Î¥Ñ¥¹¥ï¡¼¥É¥ì¥³¡¼¥É¤Ë½ñ¤«¤ì¤Æ¤¤¤ë¥°¥ë¡¼¥× ID ¤ò»ØÄꤹ¤ë¡£
+のパスワードレコードに書かれているグループ ID を指定する。
.\"O The
.\"O .I ngroups
.\"O .IR group ;
.\"O this value may be greater than the number of groups stored in
.\"O .IR groups .
-°ú¤¿ô
+引き数
.I ngroups
-¤Ï¡¢ÃÍÅϤ·¤È·ë²Ì¤ÎξÊý¤Ë»ÈÍѤµ¤ì¤ë°ú¤¿ô (value-result argument) ¤Ç¤¢¤ê¡¢
-¥ê¥¿¡¼¥ó»þ¤Ë¤Ï¡¢¾ï¤Ë
+は、値渡しと結果の両方に使用される引き数 (value-result argument) であり、
+リターン時には、常に
.I group
-¤â´Þ¤á¤¿
+も含めた
.I user
-¤¬½ê°¤¹¤ë¥°¥ë¡¼¥×¿ô¤¬³ÊǼ¤µ¤ì¤ë¡£
-¤³¤ÎÃͤÏ
+が所属するグループ数が格納される。
+この値は
.I groups
-¤Ë³ÊǼ¤µ¤ì¤¿¥°¥ë¡¼¥×¿ô¤è¤êÂ礤¯¤Ê¤ë²ÄǽÀ¤¬¤¢¤ë¡£
+に格納されたグループ数より大きくなる可能性がある。
.\"O .SH "RETURN VALUE"
-.SH ÊÖ¤êÃÍ
+.SH 返り値
.\"O If the number of groups of which
.\"O .I user
.\"O is a member is less than or equal to
.\"O .I *ngroups
.\"O is returned.
.I user
-¤¬½ê°¤·¤Æ¤¤¤ë¥°¥ë¡¼¥×¿ô¤¬
+が所属しているグループ数が
.I *ngroups
-°Ê²¼¤Î¾ì¹ç¡¢
+以下の場合、
.I *ngroups
-¤ÎÃͤ¬ÊÖ¤µ¤ì¤ë¡£
+の値が返される。
.\"O If the user is a member of more than
.\"O .I *ngroups
.\"O groups, then
.\"O .BR getgrouplist ()
.\"O returns \-1.
-»ØÄꤵ¤ì¤¿¥æ¡¼¥¶¤¬
+指定されたユーザが
.I *ngroups
-¤è¤ê¿¤¯¤Î¥°¥ë¡¼¥×¤Ë½ê°¤·¤Æ¤¤¤ë¾ì¹ç¡¢
+より多くのグループに所属している場合、
.BR getgrouplist ()
-¤Ï \-1 ¤òÊÖ¤¹¡£
+は \-1 を返す。
.\"O In this case the value returned in
.\"O .IR *ngroups
.\"O can be used to resize the buffer passed to a further call
.\"O .BR getgrouplist ().
-¤³¤Î¾ì¹ç¡¢
+この場合、
.I *ngroups
-¤ÇÊÖ¤µ¤ì¤ëÃͤò»È¤Ã¤Æ¡¢¥Ð¥Ã¥Õ¥¡¤Î¥µ¥¤¥º¤òÊѹ¹¤·¤Æ¤«¤é¡¢
+で返される値を使って、バッファのサイズを変更してから、
.BR getgrouplist ()
-¤ò¤â¤¦°ìÅٸƤӽФ¹¤³¤È¤¬¤Ç¤¤ë¡£
+をもう一度呼び出すことができる。
.\"O .SH "VERSIONS"
-.SH ¥Ð¡¼¥¸¥ç¥ó
+.SH バージョン
.\"O This function is present since glibc 2.2.4.
-¤³¤Î´Ø¿ô¤Ï glibc 2.2.4 ¤«¤é¸ºß¤¹¤ë¡£
+この関数は glibc 2.2.4 から存在する。
.\"O .SH "CONFORMING TO"
-.SH ½àµò
+.SH 準拠
.\"O This function is nonstandard; it appears on most BSDs.
-¤³¤Î´Ø¿ô¤ÏÈóɸ½à¤Ç¤¢¤ë¡£¤Û¤È¤ó¤É¤Î BSD ¤Ë¸ºß¤¹¤ë¡£
+この関数は非標準である。ほとんどの BSD に存在する。
.\"O .SH BUGS
-.SH ¥Ð¥°
+.SH ã\83\90ã\82°
.\"O In glibc versions before 2.3.3,
.\"O the implementation of this function contains a buffer-overrun bug:
.\"O it returns the complete list of groups for
.\"O .IR groups ,
.\"O even when the number of groups exceeds
.\"O .IR *ngroups .
-¥Ð¡¼¥¸¥ç¥ó 2.3.3 ¤è¤êÁ°¤Î glibc ¤Ç¤Ï¡¢
-¤³¤Î´Ø¿ô¤Î¼ÂÁõ¤Ë¤Ï¥Ð¥Ã¥Õ¥¡¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤Î¥Ð¥°¤¬¤¢¤ê¡¢
+バージョン 2.3.3 より前の glibc では、
+この関数の実装にはバッファオーバーフローのバグがあり、
.I user
-¤¬½ê°¤¹¤ë¥°¥ë¡¼¥×¿ô¤¬
+が所属するグループ数が
.I *ngroups
-¤è¤ê¿¤¤¾ì¹ç¤Ç¤¢¤Ã¤Æ¤â¡¢
+より多い場合であっても、
.I user
-¤¬½ê°¤¹¤ë¥°¥ë¡¼¥×¤ÎÁ´¥ê¥¹¥È¤òÇÛÎó
+が所属するグループの全リストを配列
.I groups
-¤Ë³ÊǼ¤·¤Æ¤·¤Þ¤¦¡£
+に格納してしまう。
.\"O .SH EXAMPLE
-.SH Îã
+.SH 例
.PP
.\"O The program below displays the group list for the user named in its
.\"O first command-line argument.
.\"O value to be supplied to
.\"O .BR getgrouplist ().
.\"O The following shell session shows examples of the use of this program:
-°Ê²¼¤Î¥×¥í¥°¥é¥à¤Ï¡¢°ì¤ÄÌܤΥ³¥Þ¥ó¥É¥é¥¤¥ó°ú¤¿ô¤Ç»ØÄꤵ¤ì¤¿Ì¾Á°¤Î¥æ¡¼¥¶
-¤¬½ê°¤¹¤ë¥°¥ë¡¼¥×¤Î¥ê¥¹¥È¤òɽ¼¨¤¹¤ë¡£
-ÆóÈÖÌܤΥ³¥Þ¥ó¥É¥é¥¤¥ó°ú¤¿ô¤Ë¤Ï¡¢
+以ä¸\8bã\81®ã\83\97ã\83ã\82°ã\83©ã\83 ã\81¯ã\80\81ä¸\80ã\81¤ç\9b®ã\81®ã\82³ã\83\9eã\83³ã\83\89ã\83©ã\82¤ã\83³å¼\95ã\81\8dæ\95°ã\81§æ\8c\87å®\9aã\81\95ã\82\8cã\81\9få\90\8då\89\8dã\81®ã\83¦ã\83¼ã\82¶
+が所属するグループのリストを表示する。
+二番目のコマンドライン引き数には、
.BR getgrouplist ()
-¤ËÅϤ¹
+に渡す
.I ngroups
-¤ÎÃͤò»ØÄꤹ¤ë¡£
-°Ê²¼¤Î¥·¥§¥ë¤Î¥»¥Ã¥·¥ç¥ó¤Ï¤³¤Î¥×¥í¥°¥é¥à¤Î»ÈÍÑÎã¤ò¼¨¤·¤¿¤â¤Î¤Ç¤¢¤ë¡£
+の値を指定する。
+以下のシェルのセッションはこのプログラムの使用例を示したものである。
.in +4n
.nf
.fi
.in
.\"O .SS Program source
-.SS ¥×¥í¥°¥é¥à¤Î¥½¡¼¥¹
+.SS ã\83\97ã\83ã\82°ã\83©ã\83 ã\81®ã\82½ã\83¼ã\82¹
\&
.nf
#include <stdio.h>
}
.fi
.\"O .SH "SEE ALSO"
-.SH ´ØÏ¢¹àÌÜ
+.SH 関連項目
.BR getgroups (2),
.BR setgroups (2),
.BR getgrent (3),