Hello, I am trying to create a debugfs file using the debugfs_create_file(...). I have written a sample code for this.

static int __init mmapexample_module_init(void)                                 
         file1 = debugfs_create_file("mmap_example", 0644, NULL, NULL, &my_fops)\
         printk(KERN_ALERT "Hello, World\n");                                    
             printk(KERN_ALERT "Error occured\n");                               
             printk(KERN_ALERT "ENODEV occured\n");                              
         return 0;                                                               

When i ran insmod i could get the Hello, World message but no the error message. So i think the debugfs_create_file worked fine. However i couldn't find any file in /sys/kernel/debug. The folder is there but it is empty. Can anyone help me with this? Thank you...

Thanks, Bala

asked 05 May '10, 00:03

bala1486's gravatar image

accept rate: 0%

edited 05 May '10, 01:11

Web31337's gravatar image


Please accept an answer so the question/answer can be finished. Or provide more details so we can help.

(20 Apr '11, 13:55) rfelsburg ♦


Firstly, did you check the logs ? the dmesg ? Also, try

echo 8 > /proc/sys/kernel/printk 

so that you get all types of messages to go to the console.

Secondly, do you have your debugfs mounted properly ? I would do a mount | grep 'debugfs' to check.

I am not even a newbie in linux kernel programming but hope this helps you somehow :)


answered 05 May '10, 20:05

Knight%20Samar's gravatar image

Knight Samar
accept rate: 33%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 05 May '10, 00:03

Seen: 3,225 times

Last updated: 20 Apr '11, 13:55

powered by OSQA