Debugfs

From Wikipedia, the free encyclopedia
Jump to: navigation, search
For the ext file system debugger, see e2fsprogs.

debugfs is a special filesystem (technically referred as a kernel space-user-space interface) available in Linux kernel since version 2.6.10-rc3.[1] It was written by Greg Kroah-Hartman.[2]

Purpose[edit]

It is a simple to use RAM-based file system specially designed for debugging purposes. debugfs exists as a simple way for kernel developers to make information available to user space.[3]

Unlike /proc, which is only meant for information about a process, or sysfs, which has strict one-value-per-file rules, debugfs has no rules at all. Developers can put any information they want there.[4]

Usage[edit]

To compile a Linux kernel with the debugfs facility, the CONFIG_DEBUG_FS option must be set to yes.

It is typically mounted in /sys/kernel/debug with a command like:

mount -t debugfs none /sys/kernel/debug

[5]

It can be manipulated using several calls from the C header file linux/debugfs.h

These include:

  • debugfs_create_file — for creating a file in the debug filesystem
  • debugfs_create_dir — for creating a directory inside the debug filesystem
  • debugfs_remove — for removing a debugfs entry from the debug filesytem.

References[edit]

  1. ^ Linux: DebugFS, by Jeremy, December 11, 2004, KernelTrap. (Announcement of debugfs by Greg KH.)
  2. ^ Debugfs, Posted:December 13, 2004, by corbet, LWN
  3. ^ Linux Kernel Documentation :: filesystems : debugfs.txt documentation from the source code (Based on kernel version 2.6.35.4. Page generated on 2010-09-02 21:39 EST.)
  4. ^ An updated guide to debugfs, By Jonathan Corbet, May 25, 2009, LWN
  5. ^ 2.5 Debugfs A guide to using debugfs, Ariane Keller, Version 0.8, July 2008, Kernel Space - User Space Interfaces

External links[edit]