1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
|
.\" Copyright (C) 1995 Andries Brouwer (aeb@cwi.nl)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Written 11 June 1995 by Andries Brouwer <aeb@cwi.nl>
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\" all rights reserved.
.\" Translated Mon Dec 16 11:16:34 JST 2001
.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated Thu Mar 6 2003 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\"
.\"WORD: kernel ͥ
.\"WORD: message ring buffer åХåե
.\"WORD: library 饤֥
.\"WORD: kernel log buffer ͥ롦Хåե
.\"WORD: console
.\"WORD: kernel panic ͥ롦ѥ˥å
.\"WORD: loglevel ٥
.\"WORD: debug message ǥХåå
.\"
.TH SYSLOG 2 2007-06-01 "Linux" "Linux Programmer's Manual"
.SH ̾
syslog, klogctl \- ͥΥåХåեɤõꤹ;
console_loglevel Ԥ
.SH
.nf
.BI "int syslog(int " type ", char *" bufp ", int " len );
.B " /* glibc ǤϥåѡؿƤʤ */"
.sp
/* glibc Υե */
.br
.B "#include <sys/klog.h>"
.sp
.BI "int klogctl(int " type ", char *" bufp ", int " len );
.fi
.SH
.RB ( syslogd (8)
ä) libc ؿ
.BR syslog ()
ɬפʾϡ
.BR syslog (3)
뤳ȡ
̾Υƥࡦϥͥ
.IR printk ()
Хåե椹ΤǤꡢglibc Ǥ
.BR klogctl ()
ȸƤФƤ롣
\fItype\fP Ϥδؿưꤹ롣
.I kernel/printk.c
ΰ :
.nf
/*
* Commands to sys_syslog:
*
* 0 \-\- Ĥ롣ߤμǤϲ⤷ʤ (NOP)
* 1 \-\- ߤμǤϲ⤷ʤ (NOP)
* 2 \-\- ɤ߽Ф
.\" motoki: 2005/09/06
.\" kernel-2.4 ʹߤǤ kernel/printk.c do_syslog() ϰʲ̤ǡ
.\" ɤ߽Ф¤ (1 << CONFIG_LOG_BUF_SHIFT) Ǿ 16KB Ǥ롣
.\" ¤ 4KB Ȥ original manpage εܤϰΥͥΤΤ
.\" פ롣ǤϺǿΥͥεܤѤ롣
.\" * 3 \-\- Read all messages remaining in the ring buffer.
.\" * 4 \-\- Read and clear all messages remaining in the ring buffer
* 3 \-\- Хåե˻ĤäƤå٤ɤ߽Ф
* 4 \-\- Хåե˻ĤäƤå٤ɤ߽Фõ롣
* 5 \-\- Хåեõ롣
* 6 \-\- ؤ printk ̵ˤ롣
* 7 \-\- ؤ printk ͭˤ롣
* 8 \-\- ɽåΥ٥ꤹ롣
* 9 \-\- Хåե̤ɤʸ֤
*/
.fi
root ¤Τʤץˤϵǽ 3 ΤߤĤƤ롣
(ǽ 9 Linux 2.4.10 ɲä줿)
.B ͥ롦Хåե (kernel log buffer)
.br
ͥĹ
.B LOG_BUF_LEN
(4096, 1.3.54 8192, 2.1.113 16384,
ǶΥͥǤϥѥĹǽ) νΥХåեäƤꡢ
ˤϥͥؿ
.BR printk ()
ΰȤͿ줿
å (Υ٥ˤ餺) Ǽ롣
.BR syslog ()
.RI (2, buf , len )
θƤӽФϥͥ롦ХåեǤʤʤޤԤäơ
\fIlen\fP ХȤޤ \fIbuf\fP ؤɤ߽Фɤ߹
Хȿ֤ɤޤ줿ХȤϥХåեä:
ϰ٤ɤळȤǤʤ
ϥ桼Υץब
.I /proc/kmsg
ɤ˥ͥˤäƼ¹ԤؿǤ⤢롣
.BR syslog ()
.RI (3, buf , len )
θƤӽФϥХåեκǸ \fIlen\fP ХȤ
(˲Ū)ɤ߽ФľΡ֥Хåեõ̿
(̿ϥХåեõ櫓ǤϤʤ)
ʹߤ˥Хåե˽ޤ줿ɤ߽Фʤ
֤ͤɤ߹ХȿǤ롣
.BR syslog ()
.RI (4, buf , len )
ƤӽФϡ֥Хåեõ̿¹Ԥʳ
ǽ 3 ȴƱǤ롣
.BR syslog ()
.RI (5, dummy , idummy )
ƤӽФϡ֥Хåեõ̿Τߤ¹Ԥ롣
.B ٥ (loglevel)
.br
ͥ롦롼
.BR printk ()
ϡ٥뤬
.I console_loglevel
ѿ꾮ȤˤΤߡ˥åɽ롣
.I console_loglevel
Ϻǽ
.B DEFAULT_CONSOLE_LOGLEVEL
(7) ꤵ뤬ư˥ͥ
ޥɡ饤ץ "debug" Ȥñ줬ޤޤƤ
10 ꤵ졢ͥ롦եȤȯˤ 15 ꤵ
(â10 15 Ȥ˰̣Ϥʤ8 ƱǤ)
ѿ
.BR syslog ()
.RI (8, dummy , value )
ƤӽФˤäꤵ졢ͤϰϤ 1-8 Ǥ롣
.BR syslog ()
.RI ( type , dummy , idummy )
ƤӽФ \fItype\fP 6 ⤷ 7 ξ硢
console_loglevel 1 (ͥ롦ѥ˥åΤ)
7 (ǥХååʳ) ˤ줾ꤵ롣
åγƹԤϤ줾˥٥ġΥ٥
.I "DEFAULT_MESSAGE_LOGLEVEL \- 1"
(6) Ǥ뤬 <d> (\fId\fP 1-7 ϰϤο) ǻϤޤԤ
٥ \fId\fP Ǥ롣
٥δŪʰ̣
.I <linux/kernel.h>
˰ʲΤ褦Ƥ:
.nf
#define KERN_EMERG "<0>" /* ƥबǽ */
#define KERN_ALERT "<1>" /* ľн褬ɬ */
#define KERN_CRIT "<2>" /* ̿Ūʾ */
#define KERN_ERR "<3>" /* 顼 */
#define KERN_WARNING "<4>" /* ٹ */
#define KERN_NOTICE "<5>" /* ֤̾ʾ */
#define KERN_INFO "<6>" /* */
#define KERN_DEBUG "<7>" /* ǥХå٥ξ */
.fi
.SH ֤
顼ξ \-1 ֤졢\fIerrno\fP ꤵ롣¾ξ硢
\fItype\fP 2, 3, 4 ʤɤ߹ХȿǤʤ 0 ֤
.SH 顼
.TP
.B EINVAL
ʥѥ
.TP
.B EPERM
root θʤץ console_loglevelѹ褦Ȥ
ͥ롦åõ褦Ȥ
.TP
.B ERESTARTSYS
ƥࡦ뤬ʥˤäƳޤ졢ɤ߽Фʤä
(ȥ졼ˤȯ뤳ȤϤʤ)
.SH
Υƥࡦ Linux ͭǤꡢܿտޤץǤ
ѤƤϤʤ
.SH
ʤκ顢Ʊ̾ĥƥࡦ
饤֥ꡦ롼ۤʤʪǤΤԹʤȤ
դƤ
libc4 libc5 ǤϤΥֹ
.B SYS_klog
Ƥ
glibc2.0 ǤΥƥॳ
.BR klogctl ()
Ȥ̾˲줿
.SH Ϣ
.BR syslog (3)
|