OSDN Git Service

Retire LDP man-pages repository
[linuxjm/LDP_man-pages.git] / release / man3 / getutent.3
diff --git a/release/man3/getutent.3 b/release/man3/getutent.3
deleted file mode 100644 (file)
index 856aa70..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-.\" Copyright 1995 Mark D. Roth (roth@uiuc.edu)
-.\"
-.\" %%%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
-.\" the License, or (at your option) any later version.
-.\"
-.\" The GNU General Public License's references to "object code"
-.\" and "executables" are to be interpreted as the output of any
-.\" document formatting or typesetting system, including
-.\" intermediate and printed output.
-.\"
-.\" This manual is distributed in the hope that it will be useful,
-.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
-.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-.\" 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, see
-.\" <http://www.gnu.org/licenses/>.
-.\" %%%LICENSE_END
-.\"
-.\" References consulted:
-.\"     Linux libc source code
-.\"     Solaris manpages
-.\"
-.\" Modified Thu Jul 25 14:43:46 MET DST 1996 by Michael Haardt
-.\"     <michael@cantor.informatik.rwth-aachen.de>
-.\"
-.\"*******************************************************************
-.\"
-.\" This file was generated with po4a. Translate the source file.
-.\"
-.\"*******************************************************************
-.\"
-.\" Japanese Version Copyright (c) 1998 NAKANO Takeo all rights reserved.
-.\" Translated 1998-03-15, NAKANO Takeo <nakano@apm.seikei.ac.jp>
-.\" Updated 2001-10-16, Kentaro Shirakata <argrath@ub32.org>
-.\" Updated 2002-01-03, Kentaro Shirakata <argrath@ub32.org>
-.\" Updated 2005-03-18, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Updated 2008-08-11, Akihiro MOTOKI, LDP v3.05
-.\" Updated 2012-05-29, Akihiro MOTOKI <amotoki@gmail.com>
-.\" Updated 2013-03-26, Akihiro MOTOKI <amotoki@gmail.com>
-.\" Updated 2013-07-22, Akihiro MOTOKI <amotoki@gmail.com>
-.\"
-.TH GETUTENT 3 2014\-08\-19 "" "Linux Programmer's Manual"
-.SH 名前
-getutent, getutid, getutline, pututline, setutent, endutent, utmpname \- utmp
-ファイルのエントリーにアクセスする
-.SH 書式
-\fB#include <utmp.h>\fP
-.sp
-\fBstruct utmp *getutent(void);\fP
-.br
-\fBstruct utmp *getutid(const struct utmp *\fP\fIut\fP\fB);\fP
-.br
-\fBstruct utmp *getutline(const struct utmp *\fP\fIut\fP\fB);\fP
-.sp
-\fBstruct utmp *pututline(const struct utmp *\fP\fIut\fP\fB);\fP
-.sp
-\fBvoid setutent(void);\fP
-.br
-\fBvoid endutent(void);\fP
-.sp
-\fBint utmpname(const char *\fP\fIfile\fP\fB);\fP
-.SH 説明
-新しいアプリケーションでは、これらの関数の "utmpx" 版を使用すべきである。 これらは POSIX.1 で規定されている。「準拠」の節を参照。
-
-\fButmpname\fP()  は、他の utmp 関数がアクセスする (utmp フォーマットの)  ファイルの名前を指定する。他の関数を使う前に
-\fButmpname\fP()  を使って ファイル名の指定を行わなかった場合は、 \fI<path.h>\fP で 定義されている
-\fB_PATH_UTMP\fP がファイル名とみなされる。
-.PP
-\fBsetutent\fP()  は、ファイルポインターを utmp ファイルの先頭に移動する。
-一般的には、他の関数を使う前にこの関数を呼び出しておくと良いだろう。
-.PP
-\fBendutent\fP()  は utmp ファイルをクローズする。ユーザーコードで
-他の関数を使ってこのファイルにアクセスを行った時は、最後にこの関数を 呼び出すべきである。
-.PP
-\fBgetutent\fP()  は utmp ファイルの現在のファイル位置から一行読み込み、 行の各フィールドの内容を収めた構造体へのポインターを返す。
-この構造体の定義は \fButmp\fP(5)  に書かれている。
-.PP
-\fBgetutid\fP()  は、 utmp ファイル中の現在の位置から順方向 (末尾に向かう方向) へ \fIut\fP に基く検索を行う。
-\fIut\fP\->ut_type が \fBRUN_LVL\fP, \fBBOOT_TIME\fP, \fBNEW_TIME\fP, \fBOLD_TIME\fP の
-いずれかなら、 \fBgetutid\fP()  は \fBut_type\fP フィールドが \fIut\fP\->ut_type
-に一致する最初のエントリーを探す。 \fIut\fP\->ut_type が \fBINIT_PROCESS\fP, \fBLOGIN_PROCESS\fP,
-\fBUSER_PROCESS\fP, \fBDEAD_PROCESS\fP のいずれかなら、 \fBgetutid\fP()  は \fIut_id\fP フィールドが
-\fIut\fP\->ut_id に 一致する最初のエントリーを探す。
-.PP
-\fBgetutline\fP()  は、 utmp ファイルの現在の位置から末尾に向かって検索を行う。 \fIut_type\fP が
-\fBUSER_PROCESS\fP または \fBLOGIN_PROCESS\fP で、 \fIut_line\fP フィールドが \fIut\fP\->ut_line
-にマッチする最初の行を返す。
-.PP
-\fBpututline\fP()  は \fIutmp\fP 構造体 \fIut\fP の内容を utmp ファイルに書き出す。 \fBpututline\fP()  は
-\fBgetutid\fP()  を用いて、新たなエントリーを 挿入するのにふさわしい場所を探す。 \fIut\fP を挿入するふさわしい場所が
-見つからない場合は、新たなエントリーをファイルの末尾に追加する。
-.SH 返り値
-\fBgetutent\fP(), \fBgetutid\fP(), \fBgetutline\fP()  は、成功すると \fIstruct utmp\fP
-へのポインターを返す。 失敗すると NULL を返す (レコードが見つからなかった場合も失敗となる)。 この \fIstruct utmp\fP
-は静的な記憶領域に確保され、次にこれらの関数を 呼び出した際に上書きされるかもしれない。
-
-\fBpututline\fP()  は成功すると \fIut\fP を返す。失敗すると NULL を返す。
-
-\fButmpname\fP()  は、新しい名前の格納に成功すると 0 を返し、失敗すると \-1 を返す。
-
-エラーが発生した場合、これらの関数は \fIerrno\fP にエラーの原因を示す値を設定する。
-.SH エラー
-.TP 
-\fBENOMEM\fP
-メモリー不足。
-.TP 
-\fBESRCH\fP
-レコードが見つからなかった。
-.PP
-関数 \fBsetutent\fP(), \fBpututline\fP(), \fBgetut*\fP()  は \fBopen\fP(2)
-に書かれている理由でも失敗することがある。
-.SH ファイル
-/var/run/utmp 現在ログイン中のユーザーのデータベース
-.br
-/var/log/wtmp 過去のユーザーログインのデータベース
-.SH 準拠
-XPG2, SVr4.
-.LP
-XPG2 と SVID 2 では、 \fBpututline\fP() 関数は値を返さないとされており、 (AIX, HP\-UX などの)
-多くのシステムではそうなっている。 HP\-UX では、上述の \fBpututline\fP() と同じプロトタイプを持つ 新しい関数
-\fB_pututline\fP() が導入されている。
-.LP
-現在では、Linux 以外のシステムでは、これらの関数は全て廃止されている。 SUSv1 の後に出てきた POSIX.1\-2001
-では、もはやこれらの関数はなく、 代わりに以下のものを使う。
-.sp
-\fB#include <utmpx.h>\fP
-.sp
-\fBstruct utmpx *getutxent(void);\fP
-.br
-\fBstruct utmpx *getutxid(const struct utmpx *);\fP
-.br
-\fBstruct utmpx *getutxline(const struct utmpx *);\fP
-.br
-\fBstruct utmpx *pututxline(const struct utmpx *);\fP
-.br
-\fBvoid setutxent(void);\fP
-.br
-\fBvoid endutxent(void);\fP
-.PP
-これらの関数は glibc により提供されており、 "x" がない関数と同じ処理を行うが、 \fIstruct utmpx\fP を使用する。 Linux
-では、この構造体の定義は \fIstruct utmp\fP と同じになっている。 完全を期すために、glibc では \fButmpxname\fP()
-も提供している。この関数は POSIX.1 では規定されていない。
-.PP
-Linux 以外のシステムでは、 \fIutmpx\fP 構造体は \fIutmp\fP 構造体の上位集合 (superset) になっていて、
-追加のフィールドがあったり、既存のフィールドのサイズが大きくなっていたり するものもある。複数のファイルが使用されている場合もあり、多くの場合
-\fI/var/*/utmpx\fP と \fI/var/*/wtmpx\fP というファイルが使われる。
-.LP
-一方、 Linux glibc では複数の \fIutmpx\fP ファイル は使われていない。
-\fIutmp\fP 構造体が十分に大きいからである。
-上記の名前に "x" が付いた関数は "x" が付いていない対応する関数の別名と
-なっている (例えば \fIgetutxent\fP() は \fIgetutent\fP() の別名である)。
-.SH 注意
-.SS "glibc での注意"
-上記の関数群はスレッドセーフではない。 glibc にはリエントラント版 (reentrant) が追加されている。
-.sp
-.nf
-\fB#define _GNU_SOURCE\fP    /* or _SVID_SOURCE or _BSD_SOURCE;
-\&                          \fBfeature_test_macros\fP(7) 参照 */
-\fB#include <utmp.h>\fP
-.sp
-\fBint getutent_r(struct utmp *\fP\fIubuf\fP\fB, struct utmp **\fP\fIubufp\fP\fB);\fP
-.sp
-\fBint getutid_r(struct utmp *\fP\fIut\fP\fB,\fP
-\fB              struct utmp *\fP\fIubuf\fP\fB, struct utmp **\fP\fIubufp\fP\fB);\fP
-.sp
-\fBint getutline_r(struct utmp *\fP\fIut\fP\fB,\fP
-\fB                struct utmp *\fP\fIubuf\fP\fB, struct utmp **\fP\fIubufp\fP\fB);\fP
-.fi
-.sp
-これらの関数は GNU での拡張であり、末尾の _r をとった名前の関数と 同様の機能を持つ。 \fIubuf\fP
-パラメーターは結果を格納する場所を指定する。 成功すると 0 を返し、結果へのポインターを \fI*ubufp\fP に書き込む。エラーの場合 \-1 を返す。
-上記の関数に対応する utmpx 版は存在しない (POSIX.1 ではこれらの関数を規定されていない)。
-.SH 例
-以下の例では、 utmp のレコードの追加・削除を行っている。このコードは、 擬似端末 (pseudo terminal)
-から実行されることを想定している。 実際のアプリケーションでは \fBgetpwuid\fP(3)  と \fBttyname\fP(3)
-の戻り値を検査するべきである。
-.PP
-.nf
-#include <string.h>
-#include <stdlib.h>
-#include <pwd.h>
-#include <unistd.h>
-#include <utmp.h>
-
-int
-main(int argc, char *argv[])
-{
-    struct utmp entry;
-
-    system("echo before adding entry:;who");
-
-    entry.ut_type = USER_PROCESS;
-    entry.ut_pid = getpid();
-    strcpy(entry.ut_line, ttyname(STDIN_FILENO) + strlen("/dev/"));
-    /* only correct for ptys named /dev/tty[pqr][0\-9a\-z] */
-    strcpy(entry.ut_id, ttyname(STDIN_FILENO) + strlen("/dev/tty"));
-    time(&entry.ut_time);
-    strcpy(entry.ut_user, getpwuid(getuid())\->pw_name);
-    memset(entry.ut_host, 0, UT_HOSTSIZE);
-    entry.ut_addr = 0;
-    setutent();
-    pututline(&entry);
-
-    system("echo after adding entry:;who");
-
-    entry.ut_type = DEAD_PROCESS;
-    memset(entry.ut_line, 0, UT_LINESIZE);
-    entry.ut_time = 0;
-    memset(entry.ut_user, 0, UT_NAMESIZE);
-    setutent();
-    pututline(&entry);
-
-    system("echo after removing entry:;who");
-
-    endutent();
-    exit(EXIT_SUCCESS);
-}
-.fi
-.SH 関連項目
-\fBgetutmp\fP(3), \fButmp\fP(5)
-.SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部
-である。プロジェクトの説明とバグ報告に関する情報は
-http://www.kernel.org/doc/man\-pages/ に書かれている。