Where does printk() print to?
dmesg should display printk messages.
dmesg should display printk messages.
The corresponding kernel macros are BUG_ON and WARN_ON. The former is for when you want to make the kernel panic and bring the system down (i.e., unrecoverable error). The latter is for when you want to log something to the kernel log (viewable via dmesg). As @Michael says, in the kernel, you need to validate … Read more
In this case CPU event refers to monitoring events per CPU rather than per task. For perf tools this restricts the usage of -C, –cpu= Count only on the list of CPUs provided. Multiple CPUs can be provided as a comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2. In … Read more
It’s the BUG() macro from include/asm-i386/bug.h. /* * Tell the user there is some problem. * The offending file and line are encoded after the “officially * undefined” opcode for parsing in the trap handler. */ #ifdef CONFIG_DEBUG_BUGVERBOSE #define BUG() \ __asm__ __volatile__( “ud2\n” \ “\t.word %c0\n” \ “\t.long %c1\n” \ : : “i” (__LINE__), … Read more
Unless you want to write your own IO thread pool, the glibc implementation is an acceptable solution. It actually works surprisingly well for something that runs entirely in userland. The kernel implementation does not work with buffered IO at all in my experience (though I’ve seen other people say the opposite!). Which is fine if … Read more
The kernel’s printk.h has: #define pr_info(fmt,arg…) \ printk(KERN_INFO fmt,##arg) Just like the name, pr_info() is printk() with the KERN_INFO priority.
Proper way to fix in kernel make file would be as: # obj-m+= my_module.o #append other source files except my_module.c which would be include by default my_module-objs+= src1.o src2.o
Do I need to recompile the kernel, No. or is there a way I can get the changed value to be persistent across reboot. Yes. Use the kernel command line parameter loglevel: loglevel= All Kernel Messages with a loglevel smaller than the console loglevel will be printed to the console. It can also be changed … Read more
-ERESTARTSYS is connected to the concept of a restartable system call. A restartable system call is one that can be transparently re-executed by the kernel when there is some interruption. For instance the user space process which is sleeping in a system call can get a signal, execute a handler, and then when the handler … Read more