.\" 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 2013\-06\-21 "" "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 \fBEINTR\fP シグナルが捕捉された。 .TP \fBEIO\fP I/O エラー。 .TP \fBEMFILE\fP 呼び出したプロセスが既にファイルをオープンし過ぎている。 .TP \fBENFILE\fP システム上にオープンされたファイルが多過ぎる。 .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.65 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。