.\" 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. .\" .\"******************************************************************* .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 details" More precisely, \fBlogin\fP() takes the argument \fIut\fP struct, fills the field \fIut\->ut_type\fP (if there is such a field) with the value \fBUSER_PROCESS\fP, and fills the field \fIut\->ut_pid\fP (if there is such a field) with the process ID of the calling process. Then it tries to fill the field \fIut\->ut_line\fP. It takes the first of \fIstdin\fP, \fIstdout\fP, \fIstderr\fP that is a terminal, and stores the corresponding pathname minus a possible leading \fI/dev/\fP into this field, and then writes the struct to the utmp file. On the other hand, if no terminal name was found, this field is filled with "???" and the struct is not written to the utmp file. After this, the struct is written to the wtmp file. .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.50 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。