character-device · shipping · also character special file, character-special file

Character device

A character device is an operating-system device interface accessed through a character-special file, with supported operations determined by the device implementation.

Identity: On Linux, S_ISCHR(st_mode) tests for the character-special file type S_IFCHR. Its st_rdev holds the represented device number; st_dev instead identifies the filesystem device containing the inode. [1]

Node and driver: mknod() creates a filesystem node and records its major/minor device numbers. The kernel's cdev_add() separately makes a character device live, and cdev_init() associates its file operations. Creating a node alone is not evidence of working hardware or an available driver. [2] [3]

Removal boundary: Linux 6.12 cdev_del() prevents new opens of that registered device, but already-open instances can still call its file operations after removal returns. Deregistration is not automatic revocation of existing handles; continued callability does not promise successful I/O or surviving hardware. [3]

Operations: /dev/null and /dev/zero both discard writes; reads return EOF from /dev/null and zero-valued bytes from /dev/zero. These examples do not store the written payload. [4] Seeking support depends on the device; the character-special type alone does not promise seeking, buffering, one-byte transfers or persistence. [5] [3]

Metadata reuse: In Linux 6.12 OverlayFS, a whiteout can use a character-special node numbered 0:0 or a zero-size regular file carrying trusted.overlay.whiteout. The marker suppresses a matching lower-layer name and is hidden in the merged view; it is not an ordinary data-device interface. [6]

Relations

related
Block device, Inode, Whiteout

Limitations

  • File type and device numbers do not establish a working driver, physical hardware or durable storage.
  • The documented Linux examples do not define every operating system's device contract.

Citations

  1. Linux man-pages: inode(7), file type and represented-device identity (accessed 2026-11-15)
  2. Linux man-pages: mknod(2), device-node creation and device numbers (accessed 2026-11-15)
  3. Linux 6.12 kernel API: character-device registration and file operations (accessed 2026-11-15)
  4. Linux man-pages: null(4), null and zero device behavior (accessed 2026-11-15)
  5. Linux man-pages: lseek(2), device-specific seek support (accessed 2026-11-15)
  6. Linux 6.12: Overlay Filesystem, whiteouts and opaque directories (accessed 2026-11-15)

Further reading

  1. Hesela: device-node type is not a payload or durability contract (accessed 2026-11-15)
Sources & caveats
  • Primary-source documentation synthesis, not a device, mounted-overlay or crash experiment.
  • Concrete file types, identity fields and whiteout encodings are scoped to the cited Linux interfaces.

JSON: /data/terms/character-device.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Character device. Hesela. 2026-11-15. https://hesela.dev/terms/character-device/