OSDN Git Service

(split) LDP: Update the version to 3.53 in PO files
[linuxjm/LDP_man-pages.git] / draft / man5 / acct.5
1 .\" Copyright (C) 2008, Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\"*******************************************************************
26 .\"
27 .\" This file was generated with po4a. Translate the source file.
28 .\"
29 .\"*******************************************************************
30 .TH ACCT 5 2008\-06\-15 Linux "Linux Programmer's Manual"
31 .SH 名前
32 acct \- プロセス・アカウンティング・ファイル
33 .SH 書式
34 \fB#include <sys/acct.h>\fP
35 .SH 説明
36 カーネルがプロセス・アカウンティングのオプション (\fBCONFIG_BSD_PROCESS_ACCT\fP)  を有効にして作成されていると、以下のように
37 \fBacct\fP(2)  を呼び出すとプロセス・アカウンティングが開始される。
38
39 .in +4n
40 acct("/var/log/pacct");
41 .in
42
43 プロセス・アカウンティングが有効になっていると、カーネルは システム上の各プロセスが終了するたびにアカウンティングファイルに レコードを書き込む。
44 このレコードは、終了したプロセスに関する情報を保持するもので、 \fI<sys/acct.h>\fP で以下のように定義されている。
45
46 .in +4n
47 .nf
48 #define ACCT_COMM 16
49
50 typedef u_int16_t comp_t;
51
52 struct acct {
53     char ac_flag;           /* Accounting flags */
54     u_int16_t ac_uid;       /* Accounting user ID */
55     u_int16_t ac_gid;       /* Accounting group ID */
56     u_int16_t ac_tty;       /* Controlling terminal */
57     u_int32_t ac_btime;     /* Process creation time
58                                (seconds since the Epoch) */
59     comp_t    ac_utime;     /* User CPU time */
60     comp_t    ac_stime;     /* System CPU time */
61     comp_t    ac_etime;     /* Elapsed time */
62     comp_t    ac_mem;       /* Average memory usage (kB) */
63     comp_t    ac_io;        /* Characters transferred (unused) */
64     comp_t    ac_rw;        /* Blocks read or written (unused) */
65     comp_t    ac_minflt;    /* Minor page faults */
66     comp_t    ac_majflt;    /* Major page faults */
67     comp_t    ac_swaps;     /* Number of swaps (unused) */
68     u_int32_t ac_exitcode;  /* Process termination status
69                                (see wait(2)) */
70     char      ac_comm[ACCT_COMM+1];
71                             /* Command name (basename of last
72                                executed command; null\-terminated) */
73     char      ac_pad[\fIX\fP];    /* padding bytes */
74 };
75
76 enum {          /* Bits that may be set in ac_flag field */
77     AFORK = 0x01,           /* Has executed fork, but no exec */
78     ASU   = 0x02,           /* Used superuser privileges */
79     ACORE = 0x08,           /* Dumped core */
80     AXSIG = 0x10            /* Killed by a signal */
81 };
82 .fi
83 .in
84 .PP
85 データ型 \fIcomp_t\fP は浮動小数点値で、3 ビット幅の基数が 8 の指数部と 13 ビット幅の仮数部から 構成される。 \fIcomp_t\fP
86 型の値 \fIc\fP は以下のようにして (long 型の) 整数に変換できる。
87 .nf
88
89     v = (c & 0x1fff) << (((c >> 13) & 0x7) * 3);
90 .fi
91 .PP
92 フィールド \fIac_utime\fP, \fIac_stime\fP, \fIac_etime\fP は "clock ticks" 単位で計測した時間である。
93 これらの値を \fIsysconf(_SC_CLK_TCK)\fP で割ると、秒に変換できる。
94 .SS "バージョン 3 のアカウンティングファイルのフォーマット"
95 カーネル 2.6.8 以降では、 別のバージョンのアカウンティングファイルを生成することができ、 これを使うにはカーネル構築時に
96 \fBCONFIG_BSD_PROCESS_ACCT_V3\fP オプションが有効になっている必要がある。
97 このオプションが設定されると、アカウンティングファイルに書き込まれる レコードにフィールドが追加される。 また、フィールド \fIc_uid\fP と
98 \fIac_gid\fP の幅が 16 ビットから 32 ビットに拡張される (これは Linux 2.4 以降で UID と GID
99 のサイズが増えているのに 対応したものである)。 このレコードは以下のように定義されている。
100
101 .in +4n
102 .nf
103 struct acct_v3 {
104     char      ac_flag;      /* Flags */
105     char      ac_version;   /* Always set to ACCT_VERSION (3) */
106     u_int16_t ac_tty;       /* Controlling terminal */
107     u_int32_t ac_exitcode;  /* Process termination status */
108     u_int32_t ac_uid;       /* Real user ID */
109     u_int32_t ac_gid;       /* Real group ID */
110     u_int32_t ac_pid;       /* Process ID */
111     u_int32_t ac_ppid;      /* Parent process ID */
112     u_int32_t ac_btime;     /* Process creation time */
113     float     ac_etime;     /* Elapsed time */
114     comp_t    ac_utime;     /* User CPU time */
115     comp_t    ac_stime;     /* System time */
116     comp_t    ac_mem;       /* Average memory usage (kB) */
117     comp_t    ac_io;        /* Characters transferred (unused) */
118     comp_t    ac_rw;        /* Blocks read or written
119                                (unused) */
120     comp_t    ac_minflt;    /* Minor page faults */
121     comp_t    ac_majflt;    /* Major page faults */
122     comp_t    ac_swaps;     /* Number of swaps (unused) */
123     char      ac_comm[ACCT_COMM]; /* Command name */
124 };
125 .fi
126 .in
127 .SH バージョン
128 \fIacct_v3\fP 構造体はバージョン 2.6 以降の glibc で定義されている。
129 .SH 準拠
130 プロセスアカウンティングは BSD 由来である。 この機能はほとんどのシステムに存在するが、標準化されておらず、
131 その詳細はシステムによりいくらか異なる。
132 .SH 注意
133 アカウンティングファイルのレコードは、プロセスの終了時刻の順序となる。
134
135 バージョン 2.6.9 以前のカーネルでは、 NPTL スレッドライブラリを使って作成されたスレッドでは
136 スレッド毎に別々のアカウンティングレコードが書き込まれていた。 Linux 2.6.10 以降では、プロセス内の最後のスレッドが終了すると、
137 プロセス全体についてのアカウンティングレコードが一つだけ書き込まれる。
138
139 \fIproc/sys/kernel/acct\fP ファイル (\fBproc\fP(5)  で説明されている) は、ディスク容量の残りが少なくなった際の
140 プロセス・アカウンティングの動作を制御する設定を保持している。
141 .SH 関連項目
142 \fBlastcomm\fP(1), \fBacct\fP(2), \fBaccton\fP(8), \fBsa\fP(8)
143 .SH この文書について
144 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
145 である。プロジェクトの説明とバグ報告に関する情報は
146 http://www.kernel.org/doc/man\-pages/ に書かれている。