sys_syslog  [kernel/printk.c]


Reads and/or clears kernel message ring buffer; sets console_loglevel.

Arguments

eax 103
ebx Action to take. It amy be one of the following:
0 Close the log. Currently not implemented.
1 Open the log. Currently not implemented.
2 Read from the log.
Waits until this kernel log buffer is nonempty, and then reads at most edx bytes into the buffer pointed by edx. It returns the number of bytes read. Bytes read from the log disappear from the log buffer: the information can only be read once. This is the function executed by the kernel when a user program reads /proc/kmsg.
3 Read all messages remaining in the ring buffer.
Read the last ecx bytes from the log buffer (nondestructively) into the buffer pointed by edx. (will not read more than was written into the buffer since the last 'clear ring buffer' command (which does not clear the buffer at all)). It returns the number of bytes read.
4 Read and clear all messages remaining in the ring buffer.
Does precisely the same as 3, but also executes the `clear ring buffer' command.
5 Clear ring buffer.
Executes the `clear ring buffer' command.
ecx and edx are ignored.
6 Disable printk's to console.
Sets console loglevel to kernel panics only. ecx and edx are ignored.
7 Enable printk's to console.
Sets console loglevel to all except debugging messages. ecx and edx are ignored.
8 Set level of messages printed to console.

The kernel routine printk() will only print a message on the console, if it has a loglevel less than the value of the variable console_loglevel. This variable initially has the value DEFAULT_CONSOLE_LOGLEVEL, but is set to 10 if the kernel command line contains the word `debug', and to 15 in case of a kernel fault (the 10 and 15 are just silly, and equivalent to 8).

edx should contain the desired loglevel value in range 1-8. ecx is ignored.
Available loglevels are:
0 (KERN_EMERG) System is unusable.
1 (KERN_ALERT) Action must be taken immediately.
2 (KERN_CRIT) Critical conditions.
3 (KERN_ERR) Error conditions.
4 (KERN_WARNING) Warning conditions.
5 (KERN_NOTICE) Normal but significant condition.
6 (KERN_INFO) Informational.
7 (KERN_DEBUG) Debug-level messages.
9 Return number of unread characters in the log buffer. *to be documented*
10 Return size of the log buffer. *to be documented*
ecx This parameter depends on the action taken (ebx). See above.
edx This parameter depends on the action taken (ebx). See above.

Return values

If the system call succeeds and ebx was specified as 2, 3 or 4 the return value is the number of bytes read. Otherwise return values is 0.
If the system call fails the return value is one of the following errno values:

-EINVAL Bad parameters.
-EPERM An attempt was made to change console_loglevel or clear the kernel message ring buffer by a process without root permissions.
-ERESTARTSYS System call was interrupted by a signal; nothing was read. (This can be seen only during a trace.)

Remarks

n/a

Compatibility

n/a