I want to know how printk passes the data from the kernel space to the user space. I have heard of relayfs, which provides that the efficient and unified file-system to transfer huge data from the kernel space to user space, whether printk also uses relayfs or it has its own implementation??
Asked
Active
Viewed 919 times
1 Answers
4
printk
does not pass data to user space. It only writes into the kernel ring buffer. Programs like dmesg
bring it outside.
See the documentation for klogctl(2)
(man 2 klogctl
) for reading the kernel ring buffer.

wallyk
- 56,922
- 16
- 83
- 148
-
ok thanks..can you tell me how dmesg prints it in userspace ?? – pradeepchhetri Jul 13 '11 at 18:37
-
@pradeep that's why they invented opensource: http://www.koders.com/c/fid68CBE38F51D05C5CC740D894FBF2FFF130529C52.aspx – fvu Jul 13 '11 at 18:40
-
@pradeepchhetri: dmesg gets it from the kernel using `klogctl`. It then prints it to stdout the normal way. – derobert Jul 13 '11 at 18:42