Page 873 3Read up to the last 4KB of messages in the ring buffer. 4Read and clear last 4KB of messages in the ring buffer. 5Clear ring buffer. 6Disable printks to console. 7Enable printks to console. 8Set level of messages printed to console. Only function 3 is allowed to non-root processes. THE KERNEL LOG BUFFER The kernel has a cyclic buffer of length LOG_BUF_LEN (4096) in which messages given as argument to the kernel function printk() are stored (regardless of their loglevel). The call syslog (2,buf,len) waits until this kernel log buffer is nonempty, and then reads at most len bytes into the buffer buf. 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. The call syslog (3,buf,len) will read the last len bytes from the log buffer (nondestructively), but 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. The call syslog (4,buf,len) does precisely the same, but also executes the "clear ring buffer" command. The call syslog (5,dummy,idummy) only executes the "clear ring buffer" command. THE LOGLEVEL The kernel routine printk() will print a message on the console only if it has a loglevel less than the value of the variable console_loglevel (initially DEFAULT_CONSOLE_LOGLEVEL (7), but set to 10 if the kernel command line contains the word debug, and to 15 in case of a kernel faultthe 10 and 15 are just silly, and are equivalent to 8). This variable is set (to a value in the range 1_8) by the call syslog (8,dummy,value). The call syslog (type,dummy,idummy) with type equal to 6 or 7, sets it to 1 (kernel panics only) or 7 (all except debugging messages), respectively. Every text line in a message has its own loglevel. This level is DEFAULT_MESSAGE_LOGLEVEL-1 (6) unless the line starts with <d> where d is a digit in the range 1_7, in which case the level is d. The conventional meaning of the loglevel is defined in <linux/kernel.h> as follows: #define KERN_EMERG "<0>" /* system is unusable */ #define KERN_ALERT "<1>" /* action must be taken immediately */ #define KERN_CRIT "<2>" /* critical conditions */ #define KERN_ERR "<3>" /* error conditions */ #define KERN_WARNING "<4>" /* warning conditions */ #define KERN_NOTICE "<5>" /* normal but significant condition */ #define KERN_INFO "<6>" /* informational */ #define KERN_DEBUG "<7>" /* debug-level messages */ RETURN VALUE In case of error, -1 is returned, and errno is set. On success, for type equal to 2, 3, or 4, syslog() returns the number of bytes read; otherwise, it returns 0. ERRORS
Page 874 CONFORMS TO This system call is Linux specific. SEE ALSO syslog(3) Linux 1.2.9, 11 June 1995 termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed, tcgetpgrp, tcsetpgrptermios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed, tcgetpgrp, tcsetpgrpGet and set terminal attributes, do line control, get and set baud rate, get and set terminal foreground process group ID SYPNOSIS #include <termios.h> #include <unistd.h> int tcgetattr ( int fd, struct termios *termios_p ); int tcsetattr ( int fd, int optional_actions, struct termios *termios_p ); int tcsendbreak ( int fd, int duration ); int tcdrain ( int fd ); int tcflush ( int fd, int queue_selector ); int tcflow ( int fd, int action ); speed_t cfgetospeed ( struct termios *termios_p ); int cfsetospeed ( struct termios *termios_p, speed_t speed ); speed_t cfgetispeed ( struct termios *termios_p ); int cfsetispeed ( struct termios *termios_p, speed_t speed ); pid_t tcgetpgrp ( int fd ); int tcsetpgrp ( int fd, pid_t pgrpid ); DESCRIPTION The termios functions describe a general terminal interface that is provided to control asynchronous communications ports. Many of the functions described here have a termios_p argument that is a pointer to a termios structure. This structure contains the following members: tcflag_t c_iflag; /* input modes */ tcflag_t c_oflag; /* output modes */ tcflag_t c_cflag; /* control modes */ tcflag_t c_lflag;/*local modes*/ cc_t c_cc[NCCS]; /* control chars */ The following are the c_iflag flag constants:
|