.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" .\" %%%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 .\" .\" References consulted: .\" Linux libc source code .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) .\" 386BSD man pages .\" Modified Sat Jul 24 19:29:54 1993 by Rik Faith (faith@cs.unc.edu) .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997 HIROFUMI Nishizuka .\" all rights reserved. .\" Translated 1997-12-19, HIROFUMI Nishizuka .\" Updated & Modified 2004-05-30, Yuichi SATO .\" Updated & Modified 2005-09-06, Akihiro MOTOKI .\" .TH GETGRENT 3 2014\-10\-02 "" "Linux Programmer's Manual" .SH 名前 getgrent, setgrent, endgrent \- グループファイルエントリーの取得 .SH 書式 .nf \fB#include \fP \fB#include \fP .sp \fBstruct group *getgrent(void);\fP .sp \fBvoid setgrent(void);\fP .sp \fBvoid endgrent(void);\fP .fi .sp .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp .PD 0 .ad l \fBsetgrent\fP(): .RS 4 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED || .br /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L .RE .sp \fBgetgrent\fP(), \fBendgrent\fP(): .RS 4 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED .RE .PD .ad b .SH 説明 \fBgetgrent\fP() 関数は、グループデータベースから取得したエントリーを 要素毎に分解し、各要素を格納した構造体へのポインターを返す (グループデータベースの例: ローカルのグループファイル \fI/etc/group\fP, NIS, LDAP)。 \fBgetgrent\fP() は、最初に呼び出された時は最初のエントリーを返し、 それ以降は呼び出される毎に次のエントリーを返す。 .PP \fBsetgrent\fP() 関数を使うと、もう一度読み込めるように、 グループデータベースの先頭に戻る。 .PP \fBendgrent\fP() 関数は、全ての処理が終わった後にグループ データベースをクローズする。 .PP \fIgroup\fP 構造体は \fI\fP で以下のように定義されている: .sp .in +4n .nf struct group { char *gr_name; /* グループ名 */ char *gr_passwd; /* グループのパスワード */ gid_t gr_gid; /* グループ ID */ char **gr_mem; /* グループのメンバ名へのポインター の配列 (配列はヌルで終端する) */ }; .fi .in .PP この構造体のフィールドの詳細は \fBgroup\fP(5) を参照のこと。 .SH 返り値 \fBgetgrent\fP() 関数は \fIgroup\fP 構造体へのポインターを返す。 これ以上エントリーが無いか、エラーが発生した場合は NULL を返す。 .LP エラーが発生すると、 \fIerrno\fP が適切に設定される。 この関数の呼び出し後に \fIerrno\fP をチェックしたい場合は、呼び出し前に \fIerrno\fP を 0 に設定しておかないといけない。 返り値は静的な領域を指しており、その後の \fBgetgrent\fP(), \fBgetgrgid\fP(3), \fBgetgrnam\fP(3) の呼び出しで上書きされるかもしれない。 (返されたポインターを \fBfree\fP(3) に渡さないこと。) .SH エラー .TP \fBEAGAIN\fP サービスが一時的に利用できなかったこと。あとでもう一度試してほしい。 NSS バックエンドの場合、glibc では、バックエンドとの通信中に一時的なエラーが発生したことを示す。 このエラーは直るかもしれないので、あとでもう一度試すよう提案している。 .TP \fBEINTR\fP シグナルが捕捉された。 .TP \fBEIO\fP I/O エラー。 .TP \fBEMFILE\fP 呼び出したプロセスが既にファイルをオープンし過ぎている。 .TP \fBENFILE\fP システム上にオープンされたファイルが多過ぎる。 .TP .\" not in POSIX \fBENOENT\fP 必要な入力ファイルが見つからなかった。 NSS バックエンドの場合、glibc では、このエラーはバックエンドが正しく設定されていないことを示す。 .TP \fBENOMEM\fP .\" not in POSIX \fIgroup\fP 構造体を割り当てるためのメモリーが不十分。 .TP \fBERANGE\fP 与えられたバッファー空間が不十分である。 .SH ファイル .TP \fI/etc/group\fP ローカルのグループデータベースファイル .SH 属性 .SS "マルチスレッディング (pthreads(7) 参照)" \fBgetgrent\fP() 関数はスレッドセーフではない。 .LP 関数 \fBsetgrent\fP() と \fBendgrent\fP() はスレッドセーフである。 .SH 準拠 SVr4, 4.3BSD, POSIX.1\-2001. .SH 関連項目 \fBfgetgrent\fP(3), \fBgetgrent_r\fP(3), \fBgetgrgid\fP(3), \fBgetgrnam\fP(3) \fBgetgrouplist\fP(3), \fBputgrent\fP(3), \fBgroup\fP(5) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。