OSDN Git Service

f84b94ba2f0ba9ee7de4970b8ea4187914af7fe6
[linuxjm/LDP_man-pages.git] / draft / man5 / utmp.5
1 .\" Copyright (c) 1993 Michael Haardt (michael@cantor.informatik.rwth-aachen.de),
2 .\" Fri Apr  2 11:32:09 MET DST 1993
3 .\"
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
8 .\"
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
13 .\"
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 .\" GNU General Public License for more details.
18 .\"
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, write to the Free
21 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
22 .\" USA.
23 .\"
24 .\" Modified 1993-07-25 by Rik Faith (faith@cs.unc.edu)
25 .\" Modified 1995-02-26 by Michael Haardt
26 .\" Modified 1996-07-20 by Michael Haardt
27 .\" Modified 1997-07-02 by Nicolas Lichtmaier <nick@debian.org>
28 .\" Modified 2004-10-31 by aeb, following Gwenole Beauchesne
29 .\"
30 .\" Japanese Version Copyright (c) 1997 Kazuyuki Tanisako
31 .\"         all rights reserved.
32 .\" Translated 1998-02-16, Kazuyuki Tanisako <tanisako@osa.dec-j.co.jp>
33 .\" Updated 2003-01-20, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
34 .\" Updated 2005-02-21, Akihiro MOTOKI
35 .\" Updated 2005-10-06, Akihiro MOTOKI
36 .\" Updated 2008-08-11, Akihiro MOTOKI, LDP v3.05
37 .\"
38 .TH UTMP 5 2011-09-28 "Linux" "Linux Programmer's Manual"
39 .\"O .SH NAME
40 .SH 名前
41 .\"O utmp, wtmp \- login records
42 utmp, wtmp \- ログイン記録
43 .\"O .SH SYNOPSIS
44 .SH 書式
45 .B #include <utmp.h>
46 .\"O .SH DESCRIPTION
47 .SH 説明
48 .\"O The
49 .\"O .I utmp
50 .\"O file allows one to discover information about who is currently using the
51 .\"O system.
52 .\"O There may be more users currently using the system, because not
53 .\"O all programs use utmp logging.
54 .I utmp
55 ファイルを見ることで、現在誰がシステムを使っているかという情報
56 が得られる。ただすべてのプログラムが utmp ファイルを
57 更新しているわけではないので、実際にはそれ以上のユーザーが
58 システムを使っている可能性がある。
59 .PP
60 .\"O .B Warning:
61 .\"O .I utmp
62 .\"O must not be writable by the user class "other",
63 .\"O because many system programs (foolishly)
64 .\"O depend on its integrity.
65 .\"O You risk faked system logfiles and
66 .\"O modifications of system files if you leave
67 .\"O .I utmp
68 .\"O writable to any user other than the owner and group owner of the file.
69 .B 警告:
70 (愚かにも) 多くのシステムプログラムがその整合性に依存しているので、
71 .I utmp
72 ファイルは "other" に分類されるユーザに対して
73 書き込み可能にしてはならない。
74 ファイルの所有者とグループオーナー以外のユーザに対して
75 .I utmp
76 ファイルを書き込み可能な状態にしておくと、
77 システムのログファイルを偽造されたり、システムファイルの
78 改ざんを受けるといったリスクを犯すことになる。
79 .PP
80 .\"O The file is a sequence of
81 .\"O .I utmp
82 .\"O structures,
83 .\"O declared as follows in
84 .\"O .IR <utmp.h>
85 .\"O (note that this is only one of several definitions
86 .\"O around; details depend on the version of libc):
87 このファイルは
88 .I utmp
89 構造体の繰り返しで構成される。
90 この構造体は
91 .I <utmp.h>
92 で以下のように定義されている
93 (ここに記述してあるのは幾つかの大まかな定義のみで、
94 詳細は libc のバージョンにより変わることに注意が必要である)。
95 .in +4n
96 .nf
97 .sp
98 /* Values for ut_type field, below */
99
100 #define EMPTY         0 /* Record does not contain valid info
101                            (formerly known as UT_UNKNOWN on Linux) */
102 #define RUN_LVL       1 /* Change in system run-level (see
103                            \fBinit\fP(8)) */
104 #define BOOT_TIME     2 /* Time of system boot (in \fIut_tv\fP) */
105 #define NEW_TIME      3 /* Time after system clock change
106                            (in \fIut_tv\fP) */
107 #define OLD_TIME      4 /* Time before system clock change
108                            (in \fIut_tv\fP) */
109 #define INIT_PROCESS  5 /* Process spawned by \fBinit\fP(8) */
110 #define LOGIN_PROCESS 6 /* Session leader process for user login */
111 #define USER_PROCESS  7 /* Normal process */
112 #define DEAD_PROCESS  8 /* Terminated process */
113 #define ACCOUNTING    9 /* Not implemented */
114
115 #define UT_LINESIZE      32
116 #define UT_NAMESIZE      32
117 #define UT_HOSTSIZE     256
118
119 struct exit_status {              /* Type for ut_exit, below */
120     short int e_termination;      /* Process termination status */
121     short int e_exit;             /* Process exit status */
122 };
123
124 struct utmp {
125     short   ut_type;              /* Type of record */
126     pid_t   ut_pid;               /* PID of login process */
127     char    ut_line[UT_LINESIZE]; /* Device name of tty \- "/dev/" */
128     char    ut_id[4];             /* Terminal name suffix,
129                                      or inittab(5) ID */
130     char    ut_user[UT_NAMESIZE]; /* Username */
131     char    ut_host[UT_HOSTSIZE]; /* Hostname for remote login, or
132                                      kernel version for run-level
133                                      messages */
134     struct  exit_status ut_exit;  /* Exit status of a process
135                                      marked as DEAD_PROCESS; not
136                                      used by Linux init(8) */
137 .\"O     /* The ut_session and ut_tv fields must be the same size when
138 .\"O        compiled 32- and 64-bit.  This allows data files and shared
139 .\"O        memory to be shared between 32- and 64-bit applications. */
140     /* ut_session と ut_tv フィールドは、32ビットでコンパイルされた場合と
141        64ビットでコンパイルされた場合で同じサイズでなければならない。
142        こうすることで、32ビットと64ビットのアプリケーションで、
143        データファイルと共有メモリを共有することができるようになる。 */
144
145 #if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
146     int32_t ut_session;           /* Session ID (\fBgetsid\fP(2)),
147                                      used for windowing */
148     struct {
149         int32_t tv_sec;           /* Seconds */
150         int32_t tv_usec;          /* Microseconds */
151     } ut_tv;                      /* Time entry was made */
152 #else
153      long   ut_session;           /* Session ID */
154      struct timeval ut_tv;        /* Time entry was made */
155 #endif
156
157     int32_t ut_addr_v6[4];        /* Internet address of remote
158                                      host; IPv4 address uses
159                                      just ut_addr_v6[0] */
160     char __unused[20];            /* Reserved for future use */
161 };
162
163 /* Backward compatibility hacks */
164 #define ut_name ut_user
165 #ifndef _NO_UT_TIME
166 #define ut_time ut_tv.tv_sec
167 #endif
168 #define ut_xtime ut_tv.tv_sec
169 #define ut_addr ut_addr_v6[0]
170 .sp
171 .fi
172 .in
173 .\"O This structure gives the name of the special file associated with the
174 .\"O user's terminal, the user's login name, and the time of login in the form
175 .\"O of
176 .\"O .BR time (2).
177 .\"O String fields are terminated by a null byte (\(aq\e0\(aq)
178 .\"O if they are shorter than the size
179 .\"O of the field.
180 この構造体からユーザーの使っている端末のスペシャルファイル名、
181 ユーザーのログイン名、
182 .RB ( time (2)
183 形式での)ログイン時刻がわかる。文字列フィールドは、
184 フィールドの長さより文字列が短い場合には、
185 NULL バイト (\(aq\e0\(aq) によって終端される。
186 .PP
187 .\"O The first entries ever created result from
188 .\"O .BR init (8)
189 .\"O processing
190 .\"O .BR inittab (5).
191 .\"O Before an entry is processed, though,
192 .\"O .BR init (8)
193 .\"O cleans up utmp by setting \fIut_type\fP to \fBDEAD_PROCESS\fP, clearing
194 .\"O \fIut_user\fP, \fIut_host\fP, and \fIut_time\fP with null bytes for each
195 .\"O record which \fIut_type\fP is not \fBDEAD_PROCESS\fP or \fBRUN_LVL\fP
196 .\"O and where no process with PID \fIut_pid\fP exists.
197 .\"O If no empty record
198 .\"O with the needed \fIut_id\fP can be found,
199 .\"O .BR init (8)
200 .\"O creates a new one.
201 .\"O It sets \fIut_id\fP from the inittab, \fIut_pid\fP and \fIut_time\fP to the
202 .\"O current values, and \fIut_type\fP to \fBINIT_PROCESS\fP.
203 最初のエントリは
204 .BR init (8)
205 コマンドが
206 .BR inittab (5)
207 を処理することで作られる。
208 あるエントリを処理する前に、
209 .BR init (8)
210 は \fIut_type\fP を \fBDEAD_PROCESS\fP に初期化する。
211 レコードの
212 \fIut_type\fP が \fBDEAD_PROCESS\fP と \fBRUN_LVL\fP のいずれでもなく、
213 かつ PID が \fIut_pid\fP であるプロセスがいない場合は、\fIut_user\fP,
214 \fIut_host\fP, \fIut_time\fP をヌルバイトでクリアして初期化を行う。
215 必要な \fIut_id\fP を持つ空のレコードを見つけられなかった場合、
216 .BR init (8)
217 は新しいレコードを作る。inittab から \fIut_id\fP を設定し、
218 \fIut_pid\fP および \fIut_time\fP を現在値に、
219 \fIut_type\fP を \fBINIT_PROCESS\fP に設定する。
220 .PP
221 .\"O .BR mingetty (8)
222 .\"O (or
223 .\"O .BR agetty (8))
224 .\"O locates the entry by the PID, changes \fIut_type\fP to
225 .\"O \fBLOGIN_PROCESS\fP, changes \fIut_time\fP, sets \fIut_line\fP, and waits
226 .\"O for connection to be established.
227 .\"O .BR login (1),
228 .\"O after a user has been
229 .\"O authenticated, changes \fIut_type\fP to \fBUSER_PROCESS\fP, changes
230 .\"O \fIut_time\fP, and sets \fIut_host\fP and \fIut_addr\fP.
231 .\"O Depending on
232 .\"O .BR mingetty (8)
233 .\"O (or
234 .\"O .BR agetty (8))
235 .\"O and
236 .\"O .BR login (1),
237 .\"O records may be located by
238 .\"O \fIut_line\fP instead of the preferable \fIut_pid\fP.
239 .BR mingetty (8)
240 (または
241 .BR agetty (8))
242 は pid でエントリを特定し、
243 \fIut_type\fP を \fBLOGIN_PROCESS\fP に変更し、
244 \fIut_time\fP を更新し、\fIut_line\fPを設定した後、接続が確立されるのを待つ。
245 .BR login (1)
246 はユーザー認証が終了すると、
247 \fIut_type\fP を \fBUSER_PROCESS\fP に変更し、
248 \fIut_time\fP を更新し、\fIut_host\fP と \fIut_addr\fPを設定する。
249 .BR mingetty (8)
250 (または
251 .BR agetty (8))
252
253 .BR login (1)
254 により異なるが、
255 \fIut_pid\fP の代わりに
256 \fIut_line\fP を使ってレコードの特定が行われることもある
257 (\fIut_pid\fP を使う方が望ましい) 。
258 .PP
259 .\"O When
260 .\"O .BR init (8)
261 .\"O finds that a process has exited, it locates its utmp
262 .\"O entry by \fIut_pid\fP, sets \fIut_type\fP to \fBDEAD_PROCESS\fP, and
263 .\"O clears \fIut_user\fP, \fIut_host\fP and \fIut_time\fP with null bytes.
264 .BR init (8)
265 はプロセスの終了を検出した場合、
266 \fIut_pid\fP をキーとして utmp のエントリを特定し、
267 \fIut_type\fP を \fBDEAD_PROCESS\fP に設定し、
268 \fIut_user\fP, \fIut_host\fP, \fIut_time\fP をヌルバイトでクリアする。
269 .PP
270 .\"O .BR xterm (1)
271 .\"O and other terminal emulators directly create a
272 .\"O \fBUSER_PROCESS\fP record and generate the \fIut_id\fP by using the
273 .\"O string that suffix part of the terminal name (the characters
274 .\"O following \fI/dev/[pt]ty\fP).
275 .\"O If they find a \fBDEAD_PROCESS\fP for this ID,
276 .\"O they recycle it, otherwise they create a new entry.
277 .\"O If they can, they
278 .\"O will mark it as \fBDEAD_PROCESS\fP on exiting and it is advised that
279 .\"O they null \fIut_line\fP, \fIut_time\fP, \fIut_user\fP, and \fIut_host\fP
280 .\"O as well.
281 .BR xterm (1)
282 コマンドや他の端末エミュレータは
283 直接 \fBUSER_PROCESS\fP のレコードを作り、
284 端末名のサフィックス文字列 (\fI/dev/[pt]ty\fP に続く文字列)
285 を使って \fIut_id\fP の値を生成する。
286 この id を持つエントリが \fBDEAD_PROCESS\fP であった場合には再利用し、
287 それ以外の場合には新しいエントリが作られる。
288 可能な場合にはプロセス終了時に \fBDEAD_PROCESS\fP と設定し、
289 さらに \fIut_line\fP, \fIut_time\fP, \fIut_user\fP, \fIut_host\fP
290 をヌルバイトでクリアすることが奨励されている。
291 .PP
292 .\"O sets up a \fBLOGIN_PROCESS\fP entry and leaves the rest to
293 .\"O .BR login (1)
294 .\"O as usual.
295 .\"O After the telnet session ends,
296 .\"O .BR telnetd (8)
297 .\"O cleans up utmp in the described way.
298 .BR telnetd (8)
299 は \fBLOGIN_PROCESS\fP を設定するだけでよく、
300 残りの処理は通常通り
301 .BR login (1)
302 に任せればよい。
303 telnet のセッションが終了した後、前述のように
304 .BR telnetd (8)
305 が utmp のエントリを初期化する。
306 .PP
307 .\"O The \fIwtmp\fP file records all logins and logouts.
308 .\"O Its format is exactly like \fIutmp\fP except that a null username
309 .\"O indicates a logout
310 .\"O on the associated terminal.
311 .\"O Furthermore, the terminal name \fB~\fP
312 .\"O with username \fBshutdown\fP or \fBreboot\fP indicates a system
313 .\"O shutdown or reboot and the pair of terminal names \fB|\fP/\fB}\fP
314 .\"O logs the old/new system time when
315 .\"O .BR date (1)
316 .\"O changes it.
317 .\"O \fIwtmp\fP is maintained by
318 .\"O .BR login (1),
319 .\"O .BR init (8),
320 .\"O and some versions of
321 .\"O .BR getty (8)
322 .\"O (e.g.,
323 .\"O .BR mingetty (8)
324 .\"O or
325 .\"O .BR agetty (8)).
326 .\"O None of these programs creates the file, so if it is
327 .\"O removed, record-keeping is turned off.
328 \fIwtmp\fP ファイルには、すべてのログインとログアウトが記録される。
329 そのフォーマットは、ログアウト済の端末でユーザー名がヌルとなること以外は
330 \fIutmp\fP とまったく同じである。
331 ユーザー名が \fBshutdown\fP もしくは \fBreboot\fP である
332 端末名 \fB~\fP はシステムの停止 (shutdown) または再起動 (reboot)
333 を意味する。またその端末名が \fB|\fP と \fB}\fP の対は
334 .BR date (1)
335 コマンドで変更した新/旧のシステム時刻を記録している。
336 \fIwtmp\fP ファイルは
337 .BR login (1),
338 .BR init (8)
339 やいくつかのバージョンの
340 .BR getty (8)
341 .RB ( mingetty (8)
342 または
343 .BR agetty (8))
344 により管理されている。
345 これらのプログラムはどれもファイルを新たに作成しないので、
346 ファイルを削除することで情報の記録 (record-keeping) を止めることができる。
347 .\"O .SH FILES
348 .SH ファイル
349 /var/run/utmp
350 .br
351 /var/log/wtmp
352 .\"O .SH "CONFORMING TO"
353 .SH 準拠
354 .PP
355 .\"O POSIX.1 does not specify a
356 .\"O .I utmp
357 .\"O structure, but rather one named
358 .\"O .IR utmpx ,
359 .\"O with specifications for the fields
360 .\"O .IR ut_type ,
361 .\"O .IR ut_pid ,
362 .\"O .IR ut_line ,
363 .\"O .IR ut_id ,
364 .\"O .IR ut_user ,
365 .\"O and
366 .\"O .IR ut_tv .
367 .\"O POSIX.1 does not specify the lengths of the
368 .\"O .I ut_line
369 .\"O and
370 .\"O .I ut_user
371 .\"O fields.
372 POSIX.1 では、
373 .I utmp
374 構造体ではなく、
375 .I utmpx
376 構造体を規定している。
377 .I utmpx
378 構造体で規定されているのは、フィールド
379 .IR ut_type ,
380 .IR ut_pid ,
381 .IR ut_line ,
382 .IR ut_id ,
383 .IR ut_user ,
384 .IR ut_tv
385 である。
386 POSIX.1 では、フィールド
387 .I ut_line
388
389 .I ut_user
390 の長さは規定されていない。
391
392 .\"O Linux defines the
393 .\"O .I utmpx
394 .\"O structure to be the same as the
395 .\"O .I utmp
396 .\"O structure.
397 Linux では、
398 .I utmpx
399 構造体の定義は
400 .I utmp
401 構造体と同じである。
402 .\"O .SS Comparison with Historical Systems
403 .SS 過去のシステムとの比較
404 .\"O Linux utmp entries conform neither to v7/BSD nor to System V; they are a
405 .\"O mix of the two.
406 Linux での utmp のエントリは v7/BSD や System V のいずれにも準拠しておらず、
407 その両方が混在したものである。
408
409 .\"O v7/BSD has fewer fields; most importantly it lacks
410 .\"O \fIut_type\fP, which causes native v7/BSD-like programs to display (for
411 .\"O example) dead or login entries.
412 .\"O Further, there is no configuration file
413 .\"O which allocates slots to sessions.
414 .\"O BSD does so because it lacks \fIut_id\fP fields.
415 v7/BSD ではより少しの項目しかない;
416 もっとも重要なことは、\fIut_type\fP が無いことである。
417 そのため v7/BSD 系のプログラムでは (たとえば) 死んだ状態のエントリや
418 ログイン状態のエントリまで表示されてしまうことになった。
419 さらにセッション用のスロットを割り当てるための設定ファイルがない。
420 BSD に設定ファイルがあるのは \fIut_id\fP がないからである。
421
422 .\"O In Linux (as in System V), the \fIut_id\fP field of a
423 .\"O record will never change once it has been set, which reserves that slot
424 .\"O without needing a configuration file.
425 .\"O Clearing \fIut_id\fP may result
426 .\"O in race conditions leading to corrupted utmp entries and potential
427 .\"O security holes.
428 .\"O Clearing the abovementioned fields by filling them
429 .\"O with null bytes is not required by System V semantics,
430 .\"O but makes it possible to run
431 .\"O many programs which assume BSD semantics and which do not modify utmp.
432 .\"O Linux uses the BSD conventions for line contents, as documented above.
433 Linux (System V 系)では、設定ファイルを必要とせず
434 セッション用のスロットを割り当てるので、一旦設定
435 されてしまうとレコードの \fIut_id\fP は決して変更されない。
436 \fIut_id\fP をクリアすると競合状態におちいり、
437 utmp のエントリを壊したり、潜在的なセキュリティホールになる可能性がある。
438 上述のフィールドを NULL バイトで埋めてクリアしておくのは、
439 System V での取り決めでは必要とはされていないが、
440 BSD での取り決めを前提としていて、かつ utmp を更新しない多くのプログラムが
441 動作するようにするためである。
442 Linux ではここまで記述してきたように、行内容の表示は BSD の慣例に従っている。
443 .PP
444 .\"O .\" mtk: What is the referrent of "them" in the following sentence?
445 .\"O .\" System V only uses the type field to mark them and logs
446 .\"O .\" informative messages such as \fB"new time"\fP in the line field.
447 .\"O System V has no \fIut_host\fP or \fIut_addr_v6\fP fields.
448 .\" mtk: What is the referrent of "them" in the following sentence?
449 .\" System V では ut_type を目印にしたり、たとえば \fB"new time"\fP のような
450 .\" 通知メッセージを記録するためのみに使っている。
451 \fBUT_UNKNOWN\fP は Linux で作られたもののようである。
452 System V には \fIut_host\fP も \fIut_addr_v6\fP も存在しない。
453 .\"O .SH NOTES
454 .SH 注意
455 .PP
456 .\"O Unlike various other
457 .\"O systems, where utmp logging can be disabled by removing the file, utmp
458 .\"O must always exist on Linux.
459 .\"O If you want to disable
460 .\"O .BR who (1)
461 .\"O then
462 .\"O do not make utmp world readable.
463 ファイルを削除することで utmp への記録を止められる
464 他の様々なシステムとは違い、Linux では utmp ファイルを必ずおいて
465 おく必要がある。
466 .BR who (1)
467 コマンドが機能しないようにしたい場合には、
468 utmp ファイルの全ユーザーに対する読み取り許可を設定しないようにする。
469 .PP
470 .\"O The file format is machine-dependent, so it is recommended that it be
471 .\"O processed only on the machine architecture where it was created.
472 ファイルのフォーマットはマシンに依存するので、ファイルが作られた
473 マシンもしくは同一アーキテクチャのマシン上でのみ処理することを推奨する。
474 .PP
475 .\"O Note that on \fIbiarch\fP platforms, that is, systems which can run both
476 .\"O 32-bit and 64-bit applications (x86-64, ppc64, s390x, etc.),
477 .\"O \fIut_tv\fP is the same size in 32-bit mode as in 64-bit mode.
478 .\"O The same goes for \fIut_session\fP and \fIut_time\fP if they are present.
479 .\"O This allows data files and shared memory to be shared between
480 .\"O 32-bit and 64-bit applications.
481 注意すべき点としては、
482 \fIbiarch\fP なプラットフォーム、つまり 32ビットと 64ビットの両方の
483 アプリケーションを実行できるシステム (x86-64, ppc64, s390x など) では、
484 \fIut_tv\fP のサイズは 32ビットモードと 64ビットモードで同じである。
485 \fIut_session\fP と \fIut_time\fP も、存在する場合には同様に同じサイズ
486 である。これにより、32ビットアプリケーションと 64ビットアプリケーション
487 の間でデータファイルと共有メモリを共有することが可能になる。
488 .\"O This is achieved by changing the type of
489 .\"O .I ut_session
490 .\"O to
491 .\"O .IR int32_t ,
492 .\"O and that of
493 .\"O .I ut_tv
494 .\"O to a struct with two
495 .\"O .I int32_t
496 .\"O fields
497 .\"O .I tv_sec
498 .\"O and
499 .\"O .IR tv_usec .
500 そのためには、
501 .I ut_session
502
503 .I int32_t
504 型に、
505 .I ut_tv
506 を 2つの
507 .I int32_t
508 型のフィールド
509 .IR tv_sec ,
510 .I tv_usec
511 を持つ構造体に変更すればよい
512 .\"O Since \fIut_tv\fP may not be the same as \fIstruct timeval\fP,
513 .\"O then instead of the call:
514 \fIut_tv\fP は \fIstruct timeval\fP と同じサイズとは限らないので、
515 .in +4n
516 .nf
517 .sp
518 gettimeofday((struct timeval *) &ut.ut_tv, NULL);
519 .fi
520 .in
521
522 のような呼び出しをするのではなく、
523 .\"O the following method of setting this field is recommended:
524 以下のように各フィールドを設定する方法が推奨される:
525 .in +4n
526 .nf
527 .sp
528 struct utmp ut;
529 struct timeval tv;
530
531 gettimeofday(&tv, NULL);
532 ut.ut_tv.tv_sec = tv.tv_sec;
533 ut.ut_tv.tv_usec = tv.tv_usec;
534 .fi
535 .in
536 .PP
537 .\"O Note that the \fIutmp\fP struct from libc5 has changed in libc6.
538 .\"O Because of this,
539 .\"O binaries using the old libc5 struct will corrupt
540 .\"O .IR /var/run/utmp " and/or " /var/log/wtmp .
541 utmp 構造体は libc5 から libc6 で変更された。そのため昔の libc5 の構造体
542 を使ったプログラムは
543 .IR /var/run/utmp " や " /var/log/wtmp
544 ファイルを壊してしまう。
545 .\"O .SH BUGS
546 .SH バグ
547 .\"O This man page is based on the libc5 one, things may work differently now.
548 この man ページは libc5 に基づいて作られていて、
549 最新のものでは違っているかもしれない。
550 .\"O .SH "SEE ALSO"
551 .SH 関連項目
552 .BR ac (1),
553 .BR date (1),
554 .BR last (1),
555 .BR login (1),
556 .BR who (1),
557 .BR getutent (3),
558 .BR getutmp (3),
559 .BR login (3),
560 .BR logout (3),
561 .BR logwtmp (3),
562 .BR updwtmp (3),
563 .BR init (8)