.\" Derived from text written by Martin Schulze (or taken from glibc.info) .\" and text written by Paul Thompson - both copyright 2002. .\" .\" %%%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 .\" . .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2004-2005 Yuichi SATO .\" all rights reserved. .\" Translated Thu Aug 26 06:04:53 JST 2004 .\" by Yuichi SATO .\" Updated & Modified Sat Jan 15 06:38:41 JST 2005 by Yuichi SATO .\" .TH LOGIN 3 2004\-05\-06 GNU "Linux Programmer's Manual" .SH 名前 login, logout \- utmp と wtmp エントリーを書き込む .SH 書式 \fB#include \fP .sp \fBvoid login(const struct utmp *\fP\fIut\fP\fB);\fP .sp \fBint logout(const char *\fP\fIut_line\fP\fB);\fP .sp \fI\-lutil\fP でリンクする。 .SH 説明 utmp ファイルは現在システムを使用しているユーザーを記録する。 wtmp ファイルはすべてのログインとログアウトを記録する。 \fButmp\fP(5) を参照すること。 .LP 関数 \fBlogin\fP() は与えられた \fIstruct utmp\fP \fIut\fP を utmp と wtmp ファイルの両方に書き込む。 .LP 関数 \fBlogout\fP() は utmp ファイルにあるエントリーをクリアする。 .SS "GNU 版の詳細" より正確には、 \fBlogin\fP() は引き数 \fIut\fP 構造体をとり、(もし存在するならば) フィールド \fIut\->ut_type\fP を \fBUSER_PROCESS\fP という値にし、(もし存在するならば) フィールド \fIut\->ut_pid\fP を呼び出し元プロセスのプロセス ID の値にする。 次にフィールド \fIut\->ut_line\fP の値を設定しようとする。 この関数は、標準入力・標準出力・標準エラー出力の中から端末である最初のものをとり、対応するパス名から先頭の \fI/dev/\fP を引いたものを このフィールドに格納して、この構造体を utmp ファイルに書き込む。 一方、端末名が見つからない場合は、このフィールドは "???" とされて、 この構造体は utmp ファイルに書き込まれない。 その後にこの構造体は wtmp ファイルに書き込まれる。 .LP \fBlogout\fP() 関数は utmp ファイルから \fIut_line\fP 引き数にマッチするエントリーを探す。 レコードが見つかった場合、 \fIut_name\fP と \fIut_host\fP フィールドをクリアして、 \fIut_tv\fP タイムスタンプフィールドを更新し、 (もし存在するならば) \fIut_type\fP フィールドを \fBDEAD_PROCESS\fP に更新する。 .SH 返り値 エントリーをデータベースに書き込むのに成功した場合、 \fBlogout\fP() 関数は 1 を返す。 またエラーが起こった場合、0 を返す。 .SH ファイル .TP \fI/var/run/utmp\fP ユーザーアカウントデータベース。 \fI\fP における \fB_PATH_UTMP\fP で設定されている。 .TP \fI/var/log/wtmp\fP ユーザーアカウントログファイル。 \fI\fP における \fB_PATH_WTMP\fP で設定されている。 .SH 準拠 POSIX.1\-2001 にはない。 BSD 系に存在する。 .SH 注意 \fIstruct utmp\fP のメンバ \fIut_user\fP は、BSD では \fIut_name\fP という名前である点に注意すること。 そのため \fIut_name\fP は \fI\fP において \fIut_user\fP のエイリアスとして定義されている。 .SH 関連項目 \fBgetutent\fP(3), \fButmp\fP(5) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。