The Linux Kernel/Human interfaces

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Char devices[edit]

A character device file is one of the most simple, fundamental and oldest concepts derived from UNIX. This kind of devices is used in many facilities from keyboard input to default interface for a sophisticated new driver. You can find a list of registered char devices on the beginning the listing of /proc/devices.

Key function cdev_addadds a char device to the system.

Tip: Browse the cross-referencing site to explore nearby API and use cases


The most common API functions:

register_chrdev, unregister_chrdev
alloc_chrdev_region/ register_chrdev_region, unregister_chrdev_region


References
- Char devicesin kernel API
- include/linux/cdev.h
- fs/char_dev.c


More info

Administration[edit]

TODO

Security[edit]

Function may_openrejects access of unauthorized users to files.

The most common functions for changing ownership and access rights (modes) to files: man 2 chown/ do_fchownat, man 2 chmod/ do_fchmodat.

TODO:

References

Debugging[edit]

User-mode debug interfaces

Kernel-mode debug facilities

Most common functions

More ...

pr_crit, pr_alert, pr_emerg

References

  • dmesg --console-level <level>
  • gdb /usr/src/linux/vmlinux /proc/kcore
  • Magic SysRq key

KDB (Built-in Kernel Debugger) Local debugging.

Other

KGDB Remote GDB debugging.

# gdb -q vmlinux
(gdb) target remote /dev/ttyS0

Subsystems[edit]

TODO

References

HID[edit]

HI device drivers[edit]