X-Git-Url: http://git.osdn.net/view?p=linuxjm%2FLDP_man-pages.git;a=blobdiff_plain;f=release%2Fman3%2Fgetpwent_r.3;h=6f136455e9701b2d0acfdc4da2a282f5b38e0506;hp=7a87b1bfbba2071808cf12213a860e75751d183d;hb=c1dfa2f6ab1bbed84992d3c59ee9925f4d453668;hpb=633a2252e0be3c867dce264a180a89ce8181d36f diff --git a/release/man3/getpwent_r.3 b/release/man3/getpwent_r.3 index 7a87b1bf..6f136455 100644 --- a/release/man3/getpwent_r.3 +++ b/release/man3/getpwent_r.3 @@ -1,5 +1,6 @@ .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl) .\" +.\" %%%LICENSE_START(GPLv2+_DOC_FULL) .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of @@ -16,117 +17,80 @@ .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public -.\" License along with this manual; if not, write to the Free -.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, -.\" USA. +.\" License along with this manual; if not, see +.\" . +.\" %%%LICENSE_END .\" -.\" Japanese Version Copyright (c) 2004 Yuichi SATO -.\" all rights reserved. -.\" Translated Sun Aug 8 00:53:40 JST 2004 -.\" by Yuichi SATO +.\"******************************************************************* .\" -.TH GETPWENT_R 3 2007-07-26 "GNU" "Linux Programmer's Manual" -.SH ̾Á° -getpwent_r, fgetpwent_r \- ¥Ñ¥¹¥ï¡¼¥É¥Õ¥¡¥¤¥ë¤Î¥¨¥ó¥È¥ê¤ò -¥ê¥¨¥ó¥È¥é¥ó¥È¤Ç¼è¤ê½Ð¤¹ -.SH ½ñ¼° +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH GETPWENT_R 3 2010\-10\-21 GNU "Linux Programmer's Manual" +.SH 名前 +getpwent_r, fgetpwent_r \- パスワードファイルのエントリを リエントラントで取り出す +.SH 書式 .nf -.B #include +\fB#include \fP .sp -.BI "int getpwent_r(struct passwd *" pwbuf ", char *" buf , +\fBint getpwent_r(struct passwd *\fP\fIpwbuf\fP\fB, char *\fP\fIbuf\fP\fB,\fP .br -.BI " size_t " buflen ", struct passwd **" pwbufp ); +\fB size_t \fP\fIbuflen\fP\fB, struct passwd **\fP\fIpwbufp\fP\fB);\fP .sp -.BI "int fgetpwent_r(FILE *" fp ", struct passwd *" pwbuf ", char *" buf , +\fBint fgetpwent_r(FILE *\fP\fIfp\fP\fB, struct passwd *\fP\fIpwbuf\fP\fB, char *\fP\fIbuf\fP\fB,\fP .br -.BI " size_t " buflen ", struct passwd **" pwbufp ); +\fB size_t \fP\fIbuflen\fP\fB, struct passwd **\fP\fIpwbufp\fP\fB);\fP .fi .sp .in -4n -glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï -.RB ( feature_test_macros (7) -»²¾È): +glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp -.BR getpwent_r (), -_BSD_SOURCE || _SVID_SOURCE +\fBgetpwent_r\fP(), _BSD_SOURCE || _SVID_SOURCE .br -.BR fgetpwent_r (): -_SVID_SOURCE -.SH ÀâÌÀ -´Ø¿ô -.BR getpwent_r () -¤È -.BR fgetpwent_r () -¤Ï -.BR getpwent (3) -¤È -.BR fgetpwent (3) -¤Î¥ê¥¨¥ó¥È¥é¥ó¥È (reentrant) ÈǤǤ¢¤ë¡£ -Á°¼Ô¤Ï¡¢ -.BR setpwent (3) -¤Ë¤è¤Ã¤Æ½é´ü²½¤µ¤ì¤¿¥¹¥È¥ê¡¼¥à¤«¤é¡¢¼¡¤Î¥Ñ¥¹¥ï¡¼¥É¥¨¥ó¥È¥ê¤òÆɤ߹þ¤à¡£ -¸å¼Ô¤Ï¡¢¥¹¥È¥ê¡¼¥à -.I fp -¤«¤é¼¡¤Î¥Ñ¥¹¥ï¡¼¥É¥¨¥ó¥È¥ê¤òÆɤ߹þ¤à¡£ +\fBfgetpwent_r\fP(): _SVID_SOURCE +.SH 説明 +関数 \fBgetpwent_r\fP() と \fBfgetpwent_r\fP() は \fBgetpwent\fP(3) と \fBfgetpwent\fP(3) +のリエントラント (reentrant) 版である。 前者は、 \fBsetpwent\fP(3) +によって初期化されたストリームから、次のパスワードエントリを読み込む。 後者は、ストリーム \fIfp\fP から次のパスワードエントリを読み込む。 .PP -\fIpasswd\fP ¹½Â¤ÂÎ¤Ï -.I -¤Ë¤ª¤¤¤Æ°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£ +\fIpasswd\fP 構造体は、\fI\fP で以下のように定義されている: .sp .in +4n .nf struct passwd { - char *pw_name; /* ¥æ¡¼¥¶Ì¾ */ - char *pw_passwd; /* ¥æ¡¼¥¶¤Î¥Ñ¥¹¥ï¡¼¥É */ - uid_t pw_uid; /* ¥æ¡¼¥¶ ID */ - gid_t pw_gid; /* ¥°¥ë¡¼¥× ID */ - char *pw_gecos; /* ¼ÂºÝ¤Î̾Á° */ - char *pw_dir; /* ¥Û¡¼¥à¥Ç¥£¥ì¥¯¥È¥ê */ - char *pw_shell; /* ¥·¥§¥ë¥×¥í¥°¥é¥à */ + char *pw_name; /* ユーザ名 */ + char *pw_passwd; /* ユーザのパスワード */ + uid_t pw_uid; /* ユーザ ID */ + gid_t pw_gid; /* グループ ID */ + char *pw_gecos; /* ユーザ情報 */ + char *pw_dir; /* ホームディレクトリ */ + char *pw_shell; /* シェルプログラム */ }; .fi .in -.sp -¥ê¥¨¥ó¥È¥é¥ó¥È¤Ç¤Ê¤¤´Ø¿ô¤ÏÀÅŪ¤Ê³ÊǼÎΰè¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£ -¤³¤ÎÀÅŪ¤Ê³ÊǼÎΰè¤Ë¤Ï¡¢¹¹¤Ë¥æ¡¼¥¶Ì¾¡¦¥Ñ¥¹¥ï¡¼¥É¡¦gecos ¥Õ¥£¡¼¥ë¥É¡¦ -¥Û¡¼¥à¥Ç¥£¥ì¥¯¥È¥ê¡¦¥·¥§¥ë¤Ø¤Î¥Ý¥¤¥ó¥¿¤¬´Þ¤Þ¤ì¤ë¡£ -¤³¤³¤ÇÀâÌÀ¤µ¤ì¤Æ¤¤¤ë¥ê¥¨¥ó¥È¥é¥ó¥ÈÈǤδؿô¤Ï¡¢ -¸Æ¤Ó½Ð¤·Â¦¤«¤éÄ󶡤µ¤ì¤ë¥Ð¥Ã¥Õ¥¡¤Ë¥æ¡¼¥¶Ì¾¤Ê¤ÉÁ´¤Æ¤òÊÖ¤¹¡£ -ºÇ½é¤Î°ú¤­¿ô¤È¤·¤Æ \fIstruct passwd\fP ¤òÊÝ»ý¤Ç¤­¤ë¥Ð¥Ã¥Õ¥¡ -.I pwbuf -¤¬¤¢¤ë¡£ -¼¡¤Ë¤½¤Î¾¤Îʸ»úÎó¤òÊÝ»ý¤Ç¤­¤ë¥µ¥¤¥º -.I buflen -¤Î¥Ð¥Ã¥Õ¥¡ -.I buf -¤¬¤¢¤ë¡£ -¤³¤ì¤é¤Î´Ø¿ô¤Î·ë²Ì (¥¹¥È¥ê¡¼¥à¤«¤éÆɤ߹þ¤Þ¤ì¤¿ \fIstruct passwd\fP) ¤Ï¡¢ -Ä󶡤µ¤ì¤¿¥Ð¥Ã¥Õ¥¡ -.I *pwbuf -¤Ë³ÊǼ¤µ¤ì¡¢¤³¤Î \fIstruct passwd\fP ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ï -.I *pwbufp -¤ËÊÖ¤µ¤ì¤ë¡£ -.SH ÊÖ¤êÃÍ -À®¸ù¤·¤¿¾ì¹ç¡¢¤³¤ì¤é¤Î´Ø¿ô¤Ï 0 ¤òÊÖ¤·¡¢ -.I *pwbufp -¤Ï \fIstruct passwd\fP ¤Ø¤Î¥Ý¥¤¥ó¥¿¤È¤Ê¤ë¡£ -¥¨¥é¡¼¤Î¾ì¹ç¡¢¤³¤ì¤é¤Î´Ø¿ô¤Ï¥¨¥é¡¼ÃͤòÊÖ¤·¡¢ -.I *pwbufp -¤Ï NULL ¤Ë¤Ê¤ë¡£ -.SH ¥¨¥é¡¼ -.TP -.B ENOENT -¼¡¤Î¥¨¥ó¥È¥ê¤¬¤Ê¤¤¡£ -.TP -.B ERANGE -½½Ê¬¤Ê¥Ð¥Ã¥Õ¥¡¶õ´Ö¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Ê¤¤¡£ -¤â¤Ã¤ÈÂ礭¤Ê¥Ð¥Ã¥Õ¥¡¤ÇºÆÅټ¹Ԥ¹¤ë¤³¤È¡£ -.SH ½àµò -¤³¤ì¤é¤Î´Ø¿ô¤Ï GNU ³ÈÄ¥¤Ç¤¢¤ê¡¢POSIX ÈǤδؿô -.BR getpwnam_r (3) -¤Î·Á¼°¤Ë»÷¤»¤Æ¤¢¤ë¡£ -¾¤Î¥·¥¹¥Æ¥à¤Ç¤Ï°Ê²¼¤Î¥×¥í¥È¥¿¥¤¥×¤¬»È¤ï¤ì¤Æ¤¤¤ë¡£ +.PP +この構造体のフィールドの詳細は \fBpasswd\fP(5) を参照のこと。 + +リエントラントでない関数は静的な格納領域へのポインタを返す。 この静的な格納領域には、更にユーザ名・パスワード・gecos フィールド・ +ホームディレクトリ・シェルへのポインタが含まれる。 ここで説明されているリエントラント版の関数は、 +呼び出し側から提供されるバッファにユーザ名など全てを返す。 最初の引き数として \fIstruct passwd\fP を保持できるバッファ \fIpwbuf\fP +がある。 次にその他の文字列を保持できるサイズ \fIbuflen\fP のバッファ \fIbuf\fP がある。 これらの関数の結果 (ストリームから読み込まれた +\fIstruct passwd\fP) は、 提供されたバッファ \fI*pwbuf\fP に格納され、この \fIstruct passwd\fP へのポインタは +\fI*pwbufp\fP に返される。 +.SH 返り値 +成功した場合、これらの関数は 0 を返し、 \fI*pwbufp\fP は \fIstruct passwd\fP へのポインタとなる。 +エラーの場合、これらの関数はエラー値を返し、 \fI*pwbufp\fP は NULL になる。 +.SH エラー +.TP +\fBENOENT\fP +次のエントリがない。 +.TP +\fBERANGE\fP +十分なバッファ空間が与えられていない。 もっと大きなバッファで再度実行すること。 +.SH 準拠 +これらの関数は GNU 拡張であり、POSIX 版の関数 \fBgetpwnam_r\fP(3) の形式に似せてある。 +他のシステムでは以下のプロトタイプが使われている。 .sp .nf .in +4n @@ -135,7 +99,7 @@ getpwent_r(struct passwd *pwd, char *buf, int buflen); .in .fi .sp -¤è¤êÎɤ¤¤â¤Î¤Ç¤Ï¡¢°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£ +より良いものでは、以下のようになっている。 .sp .nf .in +4n @@ -144,13 +108,10 @@ getpwent_r(struct passwd *pwd, char *buf, int buflen, FILE **pw_fp); .in .fi -.SH Ãí°Õ -´Ø¿ô -.BR getpwent_r () -¤ÏËÜÅö¤Î¥ê¥¨¥ó¥È¥é¥ó¥È¤Ç¤Ï¤Ê¤¤¡£ -¤Ê¤¼¤Ê¤é¡¢¥¹¥È¥ê¡¼¥à¤ÎÆɤ߹þ¤ß°ÌÃÖ¤ò -¾¤ÎÁ´¤Æ¤Î¥¹¥ì¥Ã¥É¤È¶¦Í­¤·¤Æ¤¤¤ë¤¿¤á¤Ç¤¢¤ë¡£ -.SH Îã +.SH 注意 +関数 \fBgetpwent_r\fP() は本当のリエントラントではない。 なぜなら、ストリームの読み込み位置を +他の全てのスレッドと共有しているためである。 +.SH 例 .nf #define _GNU_SOURCE #include @@ -176,7 +137,7 @@ main(void) exit(EXIT_SUCCESS); } .fi -.\" ¤¿¤Ö¤ó¥¨¥é¡¼¥Á¥§¥Ã¥¯¤òÄɲ䷤ơ¢strerror_r ¤ò»È¤¦¤Ù¤­¤À¤í¤¦¡£ +.\" perhaps add error checking - should use strerror_r .\" #include .\" #include .\" if (i) { @@ -185,11 +146,10 @@ main(void) .\" printf("getpwent_r: %s", strerror(i)); .\" exit(EXIT_SUCCESS); .\" } -.SH ´ØÏ¢¹àÌÜ -.BR fgetpwent (3), -.BR getpw (3), -.BR getpwent (3), -.BR getpwnam (3), -.BR getpwuid (3), -.BR putpwent (3), -.BR passwd (5) +.SH 関連項目 +\fBfgetpwent\fP(3), \fBgetpw\fP(3), \fBgetpwent\fP(3), \fBgetpwnam\fP(3), +\fBgetpwuid\fP(3), \fBputpwent\fP(3), \fBpasswd\fP(5) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。