Questions tagged [printk]

printk is a function that prints messages and is used in the C Programming Language exclusively for the Linux Kernel. It accepts a string parameter called the format string, which specifies a method for rendering an arbitrary number of varied data type parameter(s) into a string. The string is then printed to the kernel log.

94 questions
0
votes
0 answers

Printk process information

I have the following module which I tried to print PCB information. However I couldn't figure out the output. It was supposed to print process related data. I appreciate any help. modpcb.c #include #include #include…
arioglu
  • 11
  • 7
0
votes
2 answers

warning: array subscript is above array bounds [-Warray-bounds] in module

static int myarray[2]={-1,234}; module_param_array(myarray,int,&arrayargc,0); MODULE_PARM_DESC(myarray,"Integer Array"); static int __init module_init_2(void) { int i; for(i=0;i< (sizeof myarray/sizeof(int));i++); { printk(KERN_INFO…
Saud Farooqui
  • 27
  • 1
  • 10
0
votes
2 answers

printing the comm field of the `current` task_struct, Linux kernel

I'm trying to print the comm field of the current task_struct to print the name of a process. Then, using current->parent, I want to do the same thing for all the current process's ancestors. Here's what I've got so far: while (there is still an…
Adam
  • 8,752
  • 12
  • 54
  • 96
0
votes
2 answers

Send printk to serial

I am trying to debug a module for the Linux kernel. I heard that it is possible to send the console output to a serial port. I'm running Ubuntu on vmware and want to send printk message to the host. I have managed to set up a serial Connection and…
Dave
  • 341
  • 1
  • 4
  • 13
0
votes
1 answer

Why does printk() work only in the init/exit method of a kernel module? (Priority should be fine)

My goal is to write a kernel-module. I am following the memory tutorial of the freesoftware magazine. The tutorial works fine. I am able to compile the code. When loaded with insmod, the kernel prints <1>Inserting memory module as expected. When I…
Finn
  • 35
  • 7
0
votes
1 answer

Linux kernel : logging to a specific file

I am trying to edit the linux kernel. I want some information to be written out to a file as a part of the debugging process. I have read about the printk function. But i would like to add text to a particular file (file other from the default files…
user1836386
  • 57
  • 1
  • 8
0
votes
1 answer

What does the numbers at the beginning of prink() mean?

If you use prink() to print kernel message and read it in the console, it looks like this: <6>[ 2809.666228] amp_enable: amp enable bypass(2) <6>[ 2809.666747] amp_enable: AMP_EN is set to 0 <3>[ 2810.084296] init: untracked pid 4196 exited …
jiawen
  • 1,198
  • 2
  • 17
  • 29
0
votes
1 answer

how to view kmsg when debugging device suspend in android

I am debugging the suspend/resume process of an android phone. I am using adb shell into the phone and doing cat /proc/kmsg to view the debug message. The problem is whenever the phone suspends, it will put the usb to sleep, which will disconnects…
jiawen
  • 1,198
  • 2
  • 17
  • 29
0
votes
2 answers

Printk for Floating Values inside kernel

Is there a way to log/Print the floating values inside the kernel.Does it depends on the FPU on which the kernel is running? While compiling printk(KERN_DEBUG "error = %f " ,floatvalue) ,I am getting the error : undefined reference to __aeabi_f2d
Raulp
  • 7,758
  • 20
  • 93
  • 155
0
votes
1 answer

Android KERN_DEBUG Log Levels

Where are KERN_DEBUG log levels written to in Android? If I were, for example, to call printk(KERN_DEBUG "666 The beast lives here 666"); then where is the output written?
jdmartin86
  • 299
  • 2
  • 16
0
votes
1 answer

How do I avoid this while printing to screen?

When I do a printk with "bad" characters, sometimes I scrambles my screen, Is this unavoidable when printing them?
daisy
  • 22,498
  • 29
  • 129
  • 265
0
votes
2 answers

linux kernel printk output

I am new in Linux kernel development and when I try to modify a system call function by just adding a printk function in timekeep.c file,like printk("BEGIN!$$$$$\n"); the dmesg utility gives me output like: [ 75.919335] BEGIN!$$$$$ [ …
user2423523
  • 21
  • 1
  • 5
0
votes
0 answers

printk stopped writing to after booting into new compiled kernel

I have compiled latest Linux kernel version (3.7.6) on my VMware machine and was able to successfully boot into new kernel, however for some reason I am not able to view printk messages from kernel in syslog (I am checking /var/log/messages ),…
asio_guy
  • 3,667
  • 2
  • 19
  • 35
0
votes
1 answer

linux-kernel {{ adding sys-calls : testing from user space : data/printk issue }}

Ok, so I have successfully added some system calls to kernel space. Currently I have their primary intention commented out, I wanted to be sure data was being passed from user space to kernel space successfully and as expected. I am currently having…
0
votes
1 answer

What happens when I printk a char * that was initialized in userspace?

I implemented a new system call as an intro exercise. All it does is take in a buffer and printk that buffer. I later learned that the correct practice would be to use copy_from_user. Is this just a precautionary measure to validate the address, or…
douggard
  • 692
  • 1
  • 12
  • 29