OSDN Git Service

(split) LDP v3.30, v3.31 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man2 / syslog.2
1 .\" Copyright (C) 1995 Andries Brouwer (aeb@cwi.nl)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Written 11 June 1995 by Andries Brouwer <aeb@cwi.nl>
24 .\" 2008-02-15, Jeremy Kerr <jk@ozlabs.org>
25 .\"     Add info on command type 10; add details on types 6, 7, 8, & 9.
26 .\" 2008-02-15, Michael Kerrisk <mtk.manpages@gmail.com>
27 .\"     Update LOG_BUF_LEN details; update RETURN VALUE section.
28 .\"
29 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
30 .\"         all rights reserved.
31 .\" Translated Mon Dec 16 11:16:34 JST 2001
32 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
33 .\" Updated Thu Mar 6 2003 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
34 .\" Updated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
35 .\" Updated 2008-04-04, Akihiro MOTOKI, LDP v2.79
36 .\" Updated 2008-07-31, Akihiro MOTOKI, LDP v3.05
37 .\"
38 .\"WORD:        kernel                  ¥«¡¼¥Í¥ë
39 .\"WORD:        message ring buffer     ¥á¥Ã¥»¡¼¥¸¡¦¥ê¥ó¥°¡¦¥Ð¥Ã¥Õ¥¡
40 .\"WORD:        library                 ¥é¥¤¥Ö¥é¥ê
41 .\"WORD:        kernel log buffer       ¥«¡¼¥Í¥ë¡¦¥í¥°¡¦¥Ð¥Ã¥Õ¥¡
42 .\"WORD:        console                 ¥³¥ó¥½¡¼¥ë
43 .\"WORD:        kernel panic            ¥«¡¼¥Í¥ë¡¦¥Ñ¥Ë¥Ã¥¯
44 .\"WORD:        loglevel                ¥í¥°¥ì¥Ù¥ë
45 .\"WORD:        debug message           ¥Ç¥Ð¥Ã¥°¡¦¥á¥Ã¥»¡¼¥¸
46 .\"
47 .TH SYSLOG 2  2008-06-20 "Linux" "Linux Programmer's Manual"
48 .\"O .SH NAME
49 .SH Ì¾Á°
50 .\"O syslog, klogctl \- read and/or clear kernel message ring buffer;
51 .\"O set console_loglevel
52 syslog, klogctl \- ¥«¡¼¥Í¥ë¤Î¥á¥Ã¥»¡¼¥¸¡¦¥ê¥ó¥°¡¦¥Ð¥Ã¥Õ¥¡¤òÆɤó¤À¤ê¾Ãµî¤·¤¿¤ê¤¹¤ë;
53 console_loglevel ¤ÎÀßÄê¤ò¹Ô¤¦
54 .\"O .SH SYNOPSIS
55 .SH ½ñ¼°
56 .nf
57 .BI "int syslog(int " type ", char *" bufp ", int " len );
58 .\"O .B  "                /* No wrapper provided in glibc */"
59 .B  "                /* glibc ¤Ç¤Ï¥é¥Ã¥Ñ¡¼´Ø¿ô¤ÏÄ󶡤µ¤ì¤Æ¤¤¤Ê¤¤ */"
60 .sp
61 .\"O /* The glibc interface */
62 /* glibc ¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹ */
63 .br
64 .B "#include <sys/klog.h>"
65 .sp
66 .BI "int klogctl(int " type ", char *" bufp ", int " len );
67 .fi
68 .\"O .SH DESCRIPTION
69 .SH ÀâÌÀ
70 .\"O If you need the C library function
71 .\"O .BR syslog ()
72 .\"O (which talks to
73 .\"O .BR syslogd (8)),
74 .\"O then look at
75 .\"O .BR syslog (3).
76 .\"O The system call of this name is about controlling the kernel
77 .\"O .IR printk ()
78 .\"O buffer, and the glibc version is called
79 .\"O .BR klogctl ().
80 .RB ( syslogd (8)
81 ¤ÈÏä¹) C ¥é¥¤¥Ö¥é¥ê´Ø¿ô¤Î
82 .BR syslog ()
83 ¤¬É¬Íפʾì¹ç¤Ï¡¢
84 .BR syslog (3)
85 ¤ò¸«¤ë¤³¤È¡£
86 ¤³¤Î̾Á°¤Î¥·¥¹¥Æ¥à¡¦¥³¡¼¥ë¤Ï¥«¡¼¥Í¥ë¤Î
87 .IR printk ()
88 ¥Ð¥Ã¥Õ¥¡¤òÀ©¸æ¤¹¤ë¤â¤Î¤Ç¤¢¤ê¡¢glibc ¤Ç¤Ï
89 .BR klogctl ()
90 ¤È¸Æ¤Ð¤ì¤Æ¤¤¤ë¡£
91
92 .\"O .The \fItype\fP argument determines the action taken by this function.
93 \fItype\fP °ú¤­¿ô¤Ï¤³¤Î´Ø¿ô¤ÎÆ°ºî¤ò·èÄꤹ¤ë¡£
94
95 .\"O Quoting from
96 .\"O .IR kernel/printk.c :
97 .I kernel/printk.c
98 ¤«¤é¤Î°úÍÑ :
99 .nf
100 .\"O /*
101 .\"O  * Commands to sys_syslog:
102 .\"O  *
103 .\"O  *      0 \-\- Close the log.  Currently a NOP.
104 .\"O  *      1 \-\- Open the log. Currently a NOP.
105 .\"O  *      2 \-\- Read from the log.
106 .\"O  *      3 \-\- Read all messages remaining in the ring buffer.
107 .\"O  *      4 \-\- Read and clear all messages remaining in the ring buffer
108 .\"O  *      5 \-\- Clear ring buffer.
109 .\"O  *      6 \-\- Disable printk to console
110 .\"O  *      7 \-\- Enable printk to console
111 .\"O  *      8 \-\- Set level of messages printed to console
112 .\"O  *      9 \-\- Return number of unread characters in the log buffer
113 .\"O  *     10 \-\- Return size of the log buffer
114 .\"O  */
115 /*
116  * Commands to sys_syslog:
117  *
118  *      0 \-\- ¥í¥°¤òÊĤ¸¤ë¡£¸½ºß¤Î¼ÂÁõ¤Ç¤Ï²¿¤â¤·¤Ê¤¤ (NOP) ¡£
119  *      1 \-\- ¥í¥°¤ò³«¤¯¡£¸½ºß¤Î¼ÂÁõ¤Ç¤Ï²¿¤â¤·¤Ê¤¤ (NOP) ¡£
120  *      2 \-\- ¥í¥°¤«¤éÆɤ߽Ф¹¡£
121  *      3 \-\- ¥ê¥ó¥°¡¦¥Ð¥Ã¥Õ¥¡¤Ë»Ä¤Ã¤Æ¤¤¤ë¥á¥Ã¥»¡¼¥¸¤ò¤¹¤Ù¤ÆÆɤ߽Ф¹¡£
122  *      4 \-\- ¥ê¥ó¥°¡¦¥Ð¥Ã¥Õ¥¡¤Ë»Ä¤Ã¤Æ¤¤¤ë¥á¥Ã¥»¡¼¥¸¤ò¤¹¤Ù¤ÆÆɤ߽Ф·¡¢¾Ãµî¤¹¤ë¡£
123  *      5 \-\- ¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤ò¾Ãµî¤¹¤ë¡£
124  *      6 \-\- ¥³¥ó¥½¡¼¥ë¤Ø¤Î printk ¤ò̵¸ú¤Ë¤¹¤ë¡£
125  *      7 \-\- ¥³¥ó¥½¡¼¥ë¤Ø¤Î printk ¤òÍ­¸ú¤Ë¤¹¤ë¡£
126  *      8 \-\- ¥³¥ó¥½¡¼¥ë¤Ëɽ¼¨¤µ¤ì¤ë¥á¥Ã¥»¡¼¥¸¤Î¥ì¥Ù¥ë¤òÀßÄꤹ¤ë¡£
127  *      9 \-\- ¥í¥°¥Ð¥Ã¥Õ¥¡¤Î̤ÆɤÎʸ»ú¿ô¤òÊÖ¤¹¡£
128  *      10 \-\- ¥í¥°¥Ð¥Ã¥Õ¥¡¤Î¥µ¥¤¥º¤òÊÖ¤¹¡£
129  */
130 .fi
131
132 .\"O Only command types 3 and 10 are allowed to unprivileged processes.
133 .\"O Type 9 was added in 2.4.10; type 10 in 2.6.6.
134 ÈóÆø¢¥×¥í¥»¥¹¤Ë¤Ï¥³¥Þ¥ó¥É 3 ¤È 10 ¤Î¤ß¤¬µö²Ä¤µ¤ì¤Æ¤¤¤ë
135 (¥³¥Þ¥ó¥É 9 ¤Ï Linux 2.4.10 ¤Ç¡¢¥³¥Þ¥ó¥É 10 ¤Ï Linux 2.6.6 ¤ÇÄɲ䵤줿)¡£
136 .\"O .SS The kernel log buffer
137 .SS ¥«¡¼¥Í¥ë¡¦¥í¥°¡¦¥Ð¥Ã¥Õ¥¡ (kernel log buffer)
138 .\"O The kernel has a cyclic buffer of length
139 .\"O .B LOG_BUF_LEN
140 .\"O in which messages given as arguments to the kernel function
141 .\"O .BR printk ()
142 .\"O are stored (regardless of their loglevel).
143 .\"O In early kernels,
144 .\"O .B LOG_BUF_LEN
145 .\"O had the value 4096;
146 .\"O from kernel 1.3.54, it was 8192;
147 .\"O from kernel 2.1.113 it was 16384;
148 .\"O since 2.4.23/2.6 the value is a kernel configuration option.
149 .\"O .\" Under "General setup" ==> "Kernel log buffer size"
150 .\"O .\" For 2.6, precisely the option seems to have appeared in 2.5.55.
151 .\"O In recent kernels the size can be queried with command type 10.
152 ¥«¡¼¥Í¥ë¤ÏŤµ
153 .B LOG_BUF_LEN
154 ¤Î½ä²ó¼°¤Î¥Ð¥Ã¥Õ¥¡¤ò»ý¤Ã¤Æ¤ª¤ê¡¢
155 ¤½¤ì¤Ë¤Ï¥«¡¼¥Í¥ë´Ø¿ô¤Î
156 .BR printk ()
157 ¤Î°ú¤­¿ô¤È¤·¤ÆÍ¿¤¨¤é¤ì¤¿
158 ¥á¥Ã¥»¡¼¥¸¤¬ (¤½¤Î¥í¥°¥ì¥Ù¥ë¤Ë¤«¤«¤ï¤é¤º) ³ÊǼ¤µ¤ì¤ë¡£
159 ½é´ü¤Î¥«¡¼¥Í¥ë¤Ç¤Ï
160 .B LOG_BUF_LEN
161 ¤ÎÃͤϠ4096 ¤Ç¤¢¤Ã¤¿¡£
162 ¥«¡¼¥Í¥ë 1.3.54 ¤«¤é¤Ï 8192¡¢
163 ¥«¡¼¥Í¥ë 2.1.113 ¤«¤é¤Ï 16384 ¤Ë¤Ê¤ê¡¢
164 ¥«¡¼¥Í¥ë 2.4.23 °Ê¹ß¤ª¤è¤Ó 2.6 °Ê¹ß¤Ç¤Ï¥«¡¼¥Í¥ë¤Î¥³¥ó¥Ñ¥¤¥ë»þ¤Ë
165 ÃͤòÀßÄê¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
166 .\" Under "General setup" ==> "Kernel log buffer size"
167 .\" For 2.6, precisely the option seems to have appeared in 2.5.55.
168 ºÇ¶á¤Î¥«¡¼¥Í¥ë¤Ç¤Ï¡¢¥³¥Þ¥ó¥É 10 ¤Ç¥Ð¥Ã¥Õ¥¡¤Î¥µ¥¤¥º¤òÌ䤤¹ç¤ï¤»¤Ç¤­¤ë¡£
169
170 .\"O The call
171 .\"O .I "syslog(2,buf,len)"
172 .\"O waits until this kernel log buffer is nonempty, and then reads
173 .\"O at most \fIlen\fP bytes into the buffer \fIbuf\fP.
174 .\"O It returns
175 .\"O the number of bytes read.
176 .\"O Bytes read from the log disappear from
177 .\"O the log buffer: the information can only be read once.
178 .\"O This is the function executed by the kernel when a user program
179 .\"O reads
180 .\"O .IR /proc/kmsg .
181 .I "syslog(2,buf,len)"
182 ¤Î¸Æ¤Ó½Ð¤·¤Ï¥«¡¼¥Í¥ë¡¦¥í¥°¡¦¥Ð¥Ã¥Õ¥¡¤¬¶õ¤Ç¤Ê¤¯¤Ê¤ë¤Þ¤ÇÂԤäơ¢
183 ºÇÂç \fIlen\fP ¥Ð¥¤¥È¤Þ¤Ç \fIbuf\fP ¤Ø¤ÈÆɤ߽Ф·¡¢Æɤ߹þ¤ó¤À
184 ¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£¥í¥°¤«¤éÆɤޤ줿¥Ð¥¤¥È¤Ï¥í¥°¡¦¥Ð¥Ã¥Õ¥¡¤«¤é¾Ã¤¨¤ë:
185 ¾ðÊó¤Ï°ìÅÙ¤·¤«Æɤळ¤È¤¬¤Ç¤­¤Ê¤¤¡£
186 ¤³¤ì¤Ï¥æ¡¼¥¶¡¼¤Î¥×¥í¥°¥é¥à¤¬
187 .I /proc/kmsg
188 ¤òÆɤó¤À»þ¤Ë¥«¡¼¥Í¥ë¤Ë¤è¤Ã¤Æ¼Â¹Ô¤µ¤ì¤ë´Ø¿ô¤Ç¤â¤¢¤ë¡£
189
190 .\"O The call
191 .\"O .I syslog(3,buf,len)
192 .\"O will read the last \fIlen\fP bytes from the log buffer (nondestructively),
193 .\"O but will not read more than was written into the buffer since the
194 .\"O last "clear ring buffer" command (which does not clear the buffer at all).
195 .\"O It returns the number of bytes read.
196 .I syslog(3,buf,len)
197 ¤Î¸Æ¤Ó½Ð¤·¤Ï¥í¥°¡¦¥Ð¥Ã¥Õ¥¡¤ÎºÇ¸å¤Î \fIlen\fP ¥Ð¥¤¥È¤ò
198 (ÈóÇ˲õŪ¤Ë)Æɤ߽Ф¹¡¢¤·¤«¤·¡¢Ä¾¶á¤Î¡Ö¥ê¥ó¥°¡¦¥Ð¥Ã¥Õ¥¡¾Ãµî¡×Ì¿Îá
199 (¤³¤ÎÌ¿Îá¤Ï¥Ð¥Ã¥Õ¥¡¤ò¾Ãµî¤¹¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤)
200 °Ê¹ß¤Ë¥Ð¥Ã¥Õ¥¡¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¾ðÊó¤·¤«Æɤ߽Ф»¤Ê¤¤¡£
201 ÊÖ¤êÃͤÏÆɤ߹þ¤ó¤À¥Ð¥¤¥È¿ô¤Ç¤¢¤ë¡£
202
203 .\"O The call
204 .\"O .I syslog(4,buf,len)
205 .\"O does precisely the same, but also executes the "clear ring buffer" command.
206 .I syslog(4,buf,len)
207 ¸Æ¤Ó½Ð¤·¤Ï¡Ö¥ê¥ó¥°¡¦¥Ð¥Ã¥Õ¥¡¾Ãµî¡×Ì¿Îá¤â¼Â¹Ô¤¹¤ë°Ê³°¤Ï
208 µ¡Ç½ 3 ¤È´°Á´¤ËƱ¤¸¤Ç¤¢¤ë¡£
209
210 .\"O The call
211 .\"O .I syslog(5,dummy,dummy)
212 .\"O executes just the "clear ring buffer" command.
213 .\"O (In each call where
214 .\"O .I buf
215 .\"O or
216 .\"O .I len
217 .\"O is shown as "dummy", the value of the argument is ignored by the call.)
218 .I syslog(5,dummy,dummy)
219 ¸Æ¤Ó½Ð¤·¤Ï¡Ö¥ê¥ó¥°¡¦¥Ð¥Ã¥Õ¥¡¾Ãµî¡×Ì¿Îá¤Î¤ß¤ò¼Â¹Ô¤¹¤ë
220 (¸Æ¤Ó½Ð¤·¤Î½ñ¼°¤Ç¡¢
221 .I buf
222 ¤ä
223 .I len
224 ¤¬ "dummy" ¤Èµ­ºÜ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢¤½¤Î°ú¤­¿ô¤ÎÃͤ¬Ìµ»ë¤µ¤ì¤ë¤³¤È¤òɽ¤¹)¡£
225
226 .\"O The call
227 .\"O .I syslog(6,dummy,dummy)
228 .\"O sets the console log level to minimum, so that no messages are printed
229 .\"O to the console.
230 .I syslog(6,dummy,dummy)
231 ¸Æ¤Ó½Ð¤·¤Ï¥³¥ó¥½¡¼¥ë¤Î¥í¥°¥ì¥Ù¥ë¤òºÇ¾®¤ËÀßÄꤷ¡¢
232 ¥³¥ó¥½¡¼¥ë¤Ë¥á¥Ã¥»¡¼¥¸¤¬É½¼¨¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£
233
234 .\"O The call
235 .\"O .I syslog(7,dummy,dummy)
236 .\"O sets the console log level to default, so that messages are printed
237 .\"O to the console.
238 .I syslog(7,dummy,dummy)
239 ¸Æ¤Ó½Ð¤·¤Ï¥³¥ó¥½¡¼¥ë¤Î¥í¥°¥ì¥Ù¥ë¤ò¥Ç¥Õ¥©¥ë¥È¤ËÀßÄꤷ¡¢
240 ¥³¥ó¥½¡¼¥ë¤Ë¥á¥Ã¥»¡¼¥¸¤¬É½¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤¹¤ë¡£
241
242 .\"O The call
243 .\"O .I syslog(8,dummy,level)
244 .\"O sets the console log level to
245 .\"O .IR level ,
246 .\"O which must be an integer between 1 and 8 (inclusive).
247 .\"O See the
248 .\"O .B loglevel
249 .\"O section for details.
250 .I syslog(8,dummy,level)
251 ¸Æ¤Ó½Ð¤·¤Ï¥³¥ó¥½¡¼¥ë¤Î¥í¥°¥ì¥Ù¥ë¤ò
252 .I level
253 ¤ËÀßÄꤹ¤ë¡£
254 .I level
255 ¤Ï 1 °Ê¾å 8 °Ê²¼¤ÎÀ°¿ô¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
256 ¾ÜºÙ¤Ï
257 .B ¥í¥°¥ì¥Ù¥ë (loglevel)
258 ¤ÎÀá¤ò»²¾È¤Î¤³¤È¡£
259
260 .\"O The call
261 .\"O .I syslog(9,dummy,dummy)
262 .\"O returns the number of bytes currently available to be read
263 .\"O on the kernel log buffer.
264 .I syslog(9,dummy,dummy)
265 ¸Æ¤Ó½Ð¤·¤Ï¥«¡¼¥Í¥ë¡¦¥í¥°¥Ð¥Ã¥Õ¥¡¤Ë¤¢¤ë¸½ºßÆɤ߽Ф·²Äǽ¤Ê¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
266
267 .\"O The call
268 .\"O .I syslog(10,dummy,dummy)
269 .\"O returns the total size of the kernel log buffer.
270 .I syslog(10,dummy,dummy)
271 ¸Æ¤Ó½Ð¤·¤Ï¥«¡¼¥Í¥ë¡¦¥í¥°¥Ð¥Ã¥Õ¥¡¤ÎÁíÎ̤òÊÖ¤¹¡£
272 .\"O .SS The loglevel
273 .SS ¥í¥°¥ì¥Ù¥ë (loglevel)
274 .\"O The kernel routine
275 .\"O .BR printk ()
276 .\"O will only print a message on the
277 .\"O console, if it has a loglevel less than the value of the variable
278 .\"O .IR console_loglevel .
279 .\"O This variable initially has the value
280 .\"O .B DEFAULT_CONSOLE_LOGLEVEL
281 .\"O (7), but is set to 10 if the
282 .\"O kernel command line contains the word "debug", and to 15 in case
283 .\"O  of a kernel fault (the 10 and 15 are just silly, and equivalent to 8).
284 ¥«¡¼¥Í¥ë¡¦¥ë¡¼¥Á¥ó¤Î
285 .BR printk ()
286 ¤Ï¡¢¥í¥°¥ì¥Ù¥ë¤¬
287 .I console_loglevel
288 ÊÑ¿ô¤è¤ê¾®¤µ¤¤¤È¤­¤Ë¤Î¤ß¡¢¥³¥ó¥½¡¼¥ë¤Ë¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤¹¤ë¡£
289 .I console_loglevel
290 ¤ÏºÇ½é
291 .B DEFAULT_CONSOLE_LOGLEVEL
292 (7) ¤ËÀßÄꤵ¤ì¤ë¤¬¡¢µ¯Æ°»þ¤Ë¥«¡¼¥Í¥ë¤Î
293 ¥³¥Þ¥ó¥É¡¦¥é¥¤¥ó¡¦¥ª¥×¥·¥ç¥ó¤Ë "debug" ¤È¤¤¤¦Ã±¸ì¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï
294 10 ¤ËÀßÄꤵ¤ì¡¢¥«¡¼¥Í¥ë¡¦¥Õ¥©¡¼¥ë¥È¤¬È¯À¸¤·¤¿¾ì¹ç¤Ë¤Ï 15 ¤ËÀßÄꤵ¤ì¤ë
295 (⤷¡¢10 ¤ä 15 ¤È¤¤¤¦¿ô»ú¤Ë°ÕÌ£¤Ï¤Ê¤¯¡¢8 ¤ÈƱÅù¤Ç¤¢¤ë)¡£
296 .\"O This variable is set (to a value in the range 1-8) by the call
297 .\"O .IR syslog(8,dummy,value) .
298 .\"O The calls
299 .\"O .I syslog(type,dummy,dummy)
300 .\"O with \fItype\fP equal to 6 or 7, set it to 1 (kernel panics only)
301 .\"O or 7 (all except debugging messages), respectively.
302 ¤³¤ÎÊÑ¿ô¤Ï
303 .IR syslog(8,dummy,value) .
304 ¸Æ¤Ó½Ð¤·¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¡¢ÃͤÎÈϰϤϠ1-8 ¤Ç¤¢¤ë¡£
305 .I syslog(type,dummy,dummy)
306 ¸Æ¤Ó½Ð¤·¤Ç \fItype\fP ¤¬ 6 ¤â¤·¤¯¤Ï 7 ¤Î¾ì¹ç¡¢
307 console_loglevel ¤Ï 1 (¥«¡¼¥Í¥ë¡¦¥Ñ¥Ë¥Ã¥¯¤Î¤ß)¡¢
308 7 (¥Ç¥Ð¥Ã¥°¡¦¥á¥Ã¥»¡¼¥¸°Ê³°¤ÎÁ´¤Æ) ¤Ë¤½¤ì¤¾¤ìÀßÄꤵ¤ì¤ë¡£
309
310 .\"O Every text line in a message has its own loglevel.
311 .\"O This level is
312 .\"O .I "DEFAULT_MESSAGE_LOGLEVEL \- 1"
313 .\"O (6) unless the line starts with <d>
314 .\"O where \fId\fP is a digit in the range 1-7, in which case the level
315 .\"O is \fId\fP.
316 .\"O The conventional meaning of the loglevel is defined in
317 .\"O .I <linux/kernel.h>
318 .\"O as follows:
319 ¥á¥Ã¥»¡¼¥¸¤Î³Æ¹Ô¤Ï¤½¤ì¤¾¤ì¤Ë¥í¥°¥ì¥Ù¥ë¤ò»ý¤Ä¡£¤³¤Î¥í¥°¥ì¥Ù¥ë¤Ï
320 .I "DEFAULT_MESSAGE_LOGLEVEL \- 1"
321 (6) ¤Ç¤¢¤ë¤¬¡¢ <d> (\fId\fP ¤Ï 1-7 ¤ÎÈϰϤοô»ú) ¤Ç»Ï¤Þ¤ë¹Ô¤Î
322 ¥í¥°¥ì¥Ù¥ë¤Ï \fId\fP ¤Ç¤¢¤ë¡£
323 ¥í¥°¥ì¥Ù¥ë¤Î´·½¬Åª¤Ê°ÕÌ£¤Ï
324 .I <linux/kernel.h>
325 ¤Ë°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë:
326
327 .nf
328 .\"O #define KERN_EMERG    "<0>"  /* system is unusable               */
329 .\"O #define KERN_ALERT    "<1>"  /* action must be taken immediately */
330 .\"O #define KERN_CRIT     "<2>"  /* critical conditions              */
331 .\"O #define KERN_ERR      "<3>"  /* error conditions                 */
332 .\"O #define KERN_WARNING  "<4>"  /* warning conditions               */
333 .\"O #define KERN_NOTICE   "<5>"  /* normal but significant condition */
334 .\"O #define KERN_INFO     "<6>"  /* informational                    */
335 .\"O #define KERN_DEBUG    "<7>"  /* debug-level messages             */
336 #define KERN_EMERG    "<0>"  /* ¥·¥¹¥Æ¥à¤¬»ÈÍÑÉÔǽ          */
337 #define KERN_ALERT    "<1>"  /* Ä¾¤Á¤ËÂн褬ɬÍ×            */
338 #define KERN_CRIT     "<2>"  /* Ã×̿Ū¤Ê¾õÂÖ                */
339 #define KERN_ERR      "<3>"  /* ¥¨¥é¡¼¾õÂÖ                  */
340 #define KERN_WARNING  "<4>"  /* ·Ù¹ð¾õÂÖ                    */
341 #define KERN_NOTICE   "<5>"  /* Ä̾ï¾õÂÖ¤À¤¬Âç»ö¤Ê¾ðÊó      */
342 #define KERN_INFO     "<6>"  /* ÄÌÃΠ                       */
343 #define KERN_DEBUG    "<7>"  /* ¥Ç¥Ð¥Ã¥°¥ì¥Ù¥ë¤Î¾ðÊó        */
344 .fi
345 .\"O .SH "RETURN VALUE"
346 .SH ÊÖ¤êÃÍ
347 .\"O For \fItype\fP equal to 2, 3, or 4, a successful call to
348 .\"O .BR syslog ()
349 .\"O returns the number
350 .\"O of bytes read.
351 .\"O For \fItype\fP 9,
352 .\"O .BR syslog ()
353 .\"O returns the number of bytes currently
354 .\"O available to be read on the kernel log buffer.
355 .\"O For \fItype\fP 10,
356 .\"O .BR syslog ()
357 .\"O returns the total size of the kernel log buffer.
358 .\"O For other values of \fItype\fP, 0 is returned on success.
359 \fItype\fP ¤¬ 2, 3, 4 ¤Î¾ì¹ç¡¢À®¸ù¤¹¤ë¤È
360 .BR syslog ()
361 ¤ÏÆɤ߽Ф·¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
362 \fItype\fP ¤¬ 9 ¤Î¾ì¹ç¡¢
363 ¥«¡¼¥Í¥ë¡¦¥í¥°¥Ð¥Ã¥Õ¥¡¤Ë¤¢¤ë¸½ºßÆɤ߽Ф·²Äǽ¤Ê¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
364 \fItype\fP ¤¬ 10 ¤Î¾ì¹ç¡¢
365 ¥«¡¼¥Í¥ë¡¦¥í¥°¥Ð¥Ã¥Õ¥¡¤ÎÁíÎ̤òÊÖ¤¹¡£
366 \fItype\fP ¤¬¤½¤ì°Ê³°¤ÎÃͤξì¹ç¡¢À®¸ù¤¹¤ë¤È 0 ¤¬ÊÖ¤µ¤ì¤ë¡£
367
368 .\"O In case of error, \-1 is returned,
369 .\"O and \fIerrno\fP is set to indicate the error.
370 ¥¨¥é¡¼¤Î¾ì¹ç¤Ï¡¢\-1\ ¤¬Ê֤ꡢ
371 \fIerrno\fP ¤Ë¥¨¥é¡¼¤ò¼¨¤¹Ãͤ¬ÀßÄꤵ¤ì¤ë¡£
372 .\"O .SH ERRORS
373 .SH ¥¨¥é¡¼
374 .TP
375 .B EINVAL
376 .\"O Bad arguments (e.g.,
377 .\"O bad
378 .\"O .IR type ;
379 .\"O or for
380 .\"O .I type
381 .\"O 2, 3, or 4,
382 .\"O .I buf
383 .\"O is NULL,
384 .\"O or
385 .\"O .I len
386 .\"O is less than zero; or for
387 .\"O .I type
388 .\"O 8, the
389 .\"O .I level
390 .\"O is outside the range 1 to 8).
391 ÉÔÀµ¤Ê°ú¤­¿ô
392 (¶ñÂÎŪ¤Ë¤Ï¡¢
393 .I type
394 ¤¬Àµ¤·¤¯¤Ê¤¤¡¢¤â¤·¤¯¤Ï
395 .I type
396 ¤¬ 2, 3, 4 ¤Î¾ì¹ç¤Ë
397 .I buf
398 ¤¬ NULL ¤«
399 .I len
400 ¤¬ 0 Ì¤Ëþ¤Ç¤¢¤ë¡¢¤â¤·¤¯¤Ï
401 .I type
402 ¤¬ 8 ¤Î¾ì¹ç¤Ë
403 .I level
404 ¤¬ 1 °Ê¾å 8 °Ê²¼¤ÎÈϰϤËÆþ¤Ã¤Æ¤¤¤Ê¤¤)¡£
405 .TP
406 .B ENOSYS
407 .\"O This
408 .\"O .BR syslog ()
409 .\"O system call is not available, because the kernel was compiled with the
410 .\"O .BR CONFIG_PRINTK
411 .\"O kernel-configuration option disabled.
412 ¥«¡¼¥Í¥ë¤ÎÀßÄꥪ¥×¥·¥ç¥ó
413 .BR CONFIG_PRINTK
414 ¤ò̵¸ú¤Ë¤·¤Æ¥«¡¼¥Í¥ë¤¬¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤Æ¤¤¤ë¤¿¤á¡¢
415 .BR syslog ()
416 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤¬ÍøÍѤǤ­¤Ê¤¤¡£
417 .TP
418 .B EPERM
419 .\"O An attempt was made to change console_loglevel or clear the kernel
420 .\"O message ring buffer by a process without sufficient privilege
421 .\"O (more precisely: without the
422 .\"O .B CAP_SYS_ADMIN
423 .\"O capability).
424 ½½Ê¬¤Ê¸¢¸Â¤ò»ý¤¿¤Ê¤¤¥×¥í¥»¥¹ (Àµ³Î¤Ë¤Ï
425 .B CAP_SYS_ADMIN
426 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤¿¤Ê¤¤¥×¥í¥»¥¹) ¤¬ console_loglevel¤òÊѹ¹¤·¤è¤¦¤È¤·¤¿¤«¡¢
427 ¥«¡¼¥Í¥ë¡¦¥á¥Ã¥»¡¼¥¸¡¦¥ê¥ó¥°¤ò¾Ãµî¤·¤è¤¦¤È¤·¤¿¡£
428 .TP
429 .B ERESTARTSYS
430 .\"O System call was interrupted by a signal - nothing was read.
431 .\"O (This can be seen only during a trace.)
432 ¥·¥¹¥Æ¥à¡¦¥³¡¼¥ë¤¬¥·¥°¥Ê¥ë¤Ë¤è¤Ã¤Æ³ä¤ê¹þ¤Þ¤ì¡¢²¿¤âÆɤ߽Ф»¤Ê¤«¤Ã¤¿¡£
433 (¥È¥ì¡¼¥¹Ãæ¤Ë¤·¤«È¯À¸¤¹¤ë¤³¤È¤Ï¤Ê¤¤)
434 .\"O .SH "CONFORMING TO"
435 .SH ½àµò
436 .\"O This system call is Linux-specific and should not be used in programs
437 .\"O intended to be portable.
438 ¤³¤Î¥·¥¹¥Æ¥à¡¦¥³¡¼¥ë¤Ï Linux ÆÃÍ­¤Ç¤¢¤ê¡¢°Ü¿¢¤ò°Õ¿Þ¤·¤¿¥×¥í¥°¥é¥à¤Ç¤Ï
439 »ÈÍѤ·¤Æ¤Ï¤¤¤±¤Ê¤¤¡£
440 .\"O .SH NOTES
441 .SH Ãí°Õ
442 .\"O From the very start people noted that it is unfortunate that
443 .\"O a system call and a library routine of the same name are entirely
444 .\"O different animals.
445 .\"O In libc4 and libc5 the number of this call was defined by
446 .\"O .BR SYS_klog .
447 .\"O In glibc 2.0 the syscall is baptized
448 .\"O .BR klogctl ().
449 ¤«¤Ê¤ê½é´ü¤Îº¢¤«¤é¡¢Æ±¤¸Ì¾Á°¤ò»ý¤Ä¥·¥¹¥Æ¥à¡¦¥³¡¼¥ë¤È
450 ¥é¥¤¥Ö¥é¥ê¡¦¥ë¡¼¥Á¥ó¤¬Á´¤¯°Û¤Ê¤ëÂåʪ¤Ç¤¢¤ë¤Î¤ÏÉÔ¹¬¤Ê¤³¤È¤À¤È
451 µ¤ÉÕ¤«¤ì¤Æ¤¤¤¿¡£
452 libc4 ¤È libc5 ¤Ç¤Ï¤³¤Î¥³¡¼¥ë¤ÎÈÖ¹æ¤Ï
453 .B SYS_klog
454 ¤ÈÄêµÁ¤µ¤ì¤Æ¤¤¤¿¡£
455 glibc2.0 ¤Ç¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï
456 .BR klogctl ()
457 ¤È¤¤¤¦Ì¾Á°¤Ë²þ¤á¤é¤ì¤¿¡£
458 .\"O .SH "SEE ALSO"
459 .SH ´ØÏ¢¹àÌÜ
460 .BR syslog (3)