{
  "slug": "character-device",
  "term": "Character device",
  "aliases": [
    "character special file",
    "character-special file"
  ],
  "definition": "A character device is an operating-system device interface accessed through a character-special file, with supported operations determined by the device implementation.",
  "note": "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. [inode]\n\nNode 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. [mknod] [cdev]\n\nRemoval 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. [cdev]\n\nOperations: /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. [null] Seeking support depends on the device; the character-special type alone does not promise seeking, buffering, one-byte transfers or persistence. [lseek] [cdev]\n\nMetadata 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. [overlayfs]",
  "status": "shipping",
  "advantages": [],
  "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."
  ],
  "related": [
    "block-device",
    "inode",
    "whiteout"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-15",
  "citations": [
    {
      "id": "inode",
      "title": "Linux man-pages: inode(7), file type and represented-device identity",
      "url": "https://man7.org/linux/man-pages/man7/inode.7.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "mknod",
      "title": "Linux man-pages: mknod(2), device-node creation and device numbers",
      "url": "https://man7.org/linux/man-pages/man2/mknod.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "cdev",
      "title": "Linux 6.12 kernel API: character-device registration and file operations",
      "url": "https://docs.kernel.org/6.12/core-api/kernel-api.html#char-devices",
      "accessed": "2026-11-15"
    },
    {
      "id": "null",
      "title": "Linux man-pages: null(4), null and zero device behavior",
      "url": "https://man7.org/linux/man-pages/man4/null.4.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "lseek",
      "title": "Linux man-pages: lseek(2), device-specific seek support",
      "url": "https://man7.org/linux/man-pages/man2/lseek.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "overlayfs",
      "title": "Linux 6.12: Overlay Filesystem, whiteouts and opaque directories",
      "url": "https://docs.kernel.org/6.12/filesystems/overlayfs.html#whiteouts-and-opaque-directories",
      "accessed": "2026-11-15"
    },
    {
      "id": "hesela",
      "title": "Hesela: device-node type is not a payload or durability contract",
      "url": "https://hesela.com/analyses/atomic-rename-directory-durability/#character-device-identity",
      "accessed": "2026-11-15"
    }
  ],
  "provenance": [
    "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."
  ]
}
