1 What: /dev/kmsg 2 Date: Mai 2012 3 KernelVersion: 3.5 4 Contact: Kay Sievers <kay@vrfy.org> 5 Description: The /dev/kmsg character device 6 to the kernel's printk buffer. 7 8 Injecting messages: 9 10 Every write() to the opened de 11 the kernel's printk buffer. 12 13 The logged line can be prefixe 14 carries the syslog priority an 15 prefix number is composed of t 16 priority and the next 8 bits t 17 18 If no prefix is given, the pri 19 log priority and the facility 20 is not possible to inject mess 21 facility number LOG_KERN (0), 22 the messages can always be rel 23 24 Accessing the buffer: 25 26 Every read() from the opened d 27 of the kernel's printk buffer. 28 29 The first read() directly foll 30 first message in the buffer; t 31 persistent state; many readers 32 and read from it, without affe 33 34 Every read() will receive the 35 records are available read() w 36 used -EAGAIN returned. 37 38 Messages in the record ring bu 39 there are never partial messag 40 41 In case messages get overwritt 42 the device is kept open, the n 43 and the seek position be updat 44 Subsequent reads() will return 45 46 Unlike the classic syslog() in 47 sequence numbers allow to calc 48 messages, in case the buffer g 49 to reconnect to the buffer and 50 if needed, without limiting th 51 52 The device supports seek with 53 54 SEEK_SET, 0 55 seek to the first entry in t 56 SEEK_END, 0 57 seek after the last entry in 58 SEEK_DATA, 0 59 seek after the last record a 60 the last SYSLOG_ACTION_CLEAR 61 62 Other seek operations or offse 63 the special behavior this devi 64 or write only whole variable l 65 stored in a ring buffer. 66 67 Because of the non-standard be 68 non-standard. -ESPIPE is retur 69 is returned for other operatio 70 and values are historical and 71 risk of breaking userspace. 72 73 The output format consists of 74 prefix including priority and 75 sequence number and the monoto 76 and a flag field. All fields a 77 78 Future extensions might add mo 79 the terminating ';'. Unknown f 80 gracefully ignored. 81 82 The human readable text string 83 and is terminated by a '\n'. U 84 hardware or other facilities a 85 all non-printable characters a 86 are escaped by "\x00" C-style 87 88 A line starting with ' ', is a 89 key/value pairs to the log mes 90 readable context of the messag 91 userspace. 92 93 Example:: 94 95 7,160,424069,-;pci_root PNP0 96 SUBSYSTEM=acpi 97 DEVICE=+acpi:PNP0A03:00 98 6,339,5140900,-;NET: Registe 99 30,340,5690716,-;udevd[80]: 100 101 The DEVICE= key uniquely ident 102 103 ============ ============== 104 b12:8 block dev_t 105 c127:3 char dev_t 106 n8 netdev ifindex 107 +sound:card0 subsystem:devn 108 ============ ============== 109 110 The flags field carries '-' by 111 fragment of a line. Note, that 112 lines are not necessarily corr 113 interleaved with unrelated mes 114 the output usually produces be 115 similar logic is used internal 116 the console, /proc/kmsg or the 117 118 By default, kernel tries to av 119 when it can and fragments are 120 console support is enabled, th 121 disabled and /dev/kmsg output 122 the log consumer performs conc 123 should be the same. In the fut 124 may be removed entirely and /d 125 implement fragment handling. 126 127 Users: dmesg(1), userspace kernel log
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.