File: syslog.2

package info (click to toggle)
manpages-es 0.4a-2
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 3,592 kB
  • ctags: 3
  • sloc: sh: 59; makefile: 42
file content (167 lines) | stat: -rw-r--r-- 6,046 bytes parent folder | download
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
.\" 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>
.\" Translated into Spanish Fri Feb 6 1998 by Gerardo Aburruzaga
.\" Garca <gerardo.aburruzaga@uca.es>
.\"
.TH SYSLOG 2  "8 Febrero 1998" "Linux 1.2.9" "Manual del Programador Linux"
.SH NOMBRE
syslog \- lee o limpia el bfer del anillo de mensajes del kernel;
establece el nivel de registro de la consola
.SH SINOPSIS
.nf
.B #include <unistd.h>
.sp
.B #include <linux/unistd.h>
.sp
.B _syscall3(int, syslog, int, tipo, char *, buf, int, lon);
.sp
.BI "int syslog(int " tipo ", char *" buf ", int " lon );
.fi
.SH DESCRIPCIN
Probablemente no es sta la funcin que le interesa. Mire
.BR syslog (3)
para la interfaz de la biblioteca de C. Esta pgina documenta slo la
interfaz de la llamada al sistema desnuda.

El argumento \fItipo\fP determina la accin tomada por
.BR syslog .

Extrado (y traducido) de
.IR kernel/printk.c :
.nf
/*
 * rdenes a sys_syslog:
 *
 *      0 -- Cierra el registro. Actualmente no hace nada.
 *      1 -- Abre el registro. Actualmente no hace nada.
 *      2 -- Lee del registro.
 *      3 -- Lee hasta los ltimos 4kB de mensajes en el bfer del anillo
 *      4 -- Lee y limpia hasta los ltimos 4kB de mensajes en el bfer del anillo
 *      5 -- Limpia el bfer del anillo
 *      6 -- Desactiva los printk's a consola
 *      7 -- Activa los printk's a consola
 *      8 -- Establece el nivel de mensajes mostrados en la consola
 */
.fi

Solamente se permite la funcin 3 para procesos no de root.

.B El bfer de registro del kernel
.br
El kernel tiene un bfer cclico de longitud LOG_BUF_LEN (4096) en
el que se guardan (sin importar su nivel de registro) los mensajes
pasados como argumento a la funcin del kernel \fIprintk\fP().

La llamada
.B syslog
.RI (2, buf , lon )
espera hasta que este bfer de registro del kernel no est vaco, y
entonces lee como mucho \fIlon\fP bytes en el bffer
\fIbuf\fP. Devuelve el nmero de bytes ledos. Los bytes ledos del
registro desaparecen del bfer de registro; la informacin slo puede
leerse una vez.
Esta es la funcin ejecutada por el kernel cuando un programa de
usuario lee
.IR /proc/kmsg .

La llamada
.B syslog
.RI (3, buf , lon )
leer los ltimos \fIlon\fP bytes del bfer de registro (de forma no
destructiva), pero no leer ms de lo que se haya escrito en el bfer
desde la ltima orden 'limpiar el bfer del anillo' (que no limpia el
bfer en absoluto). Devuelve el nmero de bytes ledos.

La llamada
.B syslog
.RI (4, buf , lon )
hace precisamente lo mismo, pero tambin ejecuta la orden 'limpiar el
bfer del anillo'.

La llamada
.B syslog
.RI (5, dummy , idummy )
slo ejecuta la orden 'limpiar el bfer del anillo'.

.B EL nivel de registro
.br
La rutina del kernel \fIprintk\fP() solamente mostrar un mensaje en
la consola, si tiene un nivel de registro menor que el valor de la variable
.I console_loglevel
(inicialmente DEFAULT_CONSOLE_LOGLEVEL (7), pero puesto a 10 si la
lnea de rdenes del kernel contiene la palabra `debug', y a 15 en
caso de un fallo del kernel - los 10 y 15 son una tontera, y
equivalen a 8).
Esta variable es establecida (a un valor en el rango de	1 a 8) por la
llamada 
.B syslog
.RI (8, dummy , value ).
Las llamadas
.B syslog
.RI ( tipo , dummy , idummy )
con \fItipo\fP igual a 6  7, lo ponen a 1 (slo pnicos del kernel)
o a 7 (todos los mensajes salvo los de depuracin), respectivamente.

Cada lnea de texto en un mensaje tiene su propio nivel de
registro. Este nivel es
DEFAULT_MESSAGE_LOGLEVEL - 1 (6) a menos que la lnea comience con <d>,
donde \fId\fP es un dgito en el rango de 1 a 7, en cuyo caso el nivel
es \fId\fP. El significado convencional del nivel de registro se
define en
.I <linux/kernel.h>
as:

.nf
#define KERN_EMERG    "<0>"  /* el sistema no es utilizable       */
#define KERN_ALERT    "<1>"  /* debe tomarse una accin inmediata */
#define KERN_CRIT     "<2>"  /* condiciones crticas              */
#define KERN_ERR      "<3>"  /* condiciones de error              */
#define KERN_WARNING  "<4>"  /* condiciones de advertencia        */
#define KERN_NOTICE   "<5>"  /*condicin normal pero significativa*/
#define KERN_INFO     "<6>"  /* informacin                       */
#define KERN_DEBUG    "<7>"  /* mensajes del nivel de depuracin  */
.fi

.SH "VALOR DEVUELTO"
En caso de error, se devuelve \-1 y se pone un valor en
\fIerrno\fP. Si no, para \fItipo\fP igual a 2, 3  4, \fBsyslog\fP()
devuelve el nmero de bytes ledos, y de otro modo 0.
.SH "ERRORES"
.TP
.B EPERM
Se ha intentado cambiar console_loglevel o limpiar el bfer de anillo
de mensajes del kernel, pero el proceso no tena permisos de root.
.TP
.B EINVAL
Malos parmetros.
.TP
.B ERESTARTSYS
La llamada al sistema ha sido interrumpida por una seal; no se ha
ledo nada.
.SH "CONFORME CON"
Esta llamada al sistema es especfica de Linux y no debera emplearse
en programas que se pretendan transportables.
.SH "VASE TAMBIN"
.BR syslog (3)