# Linux Kernel Module Cheat

#### 17.8.6. Anonymous inode

Anonymous inodes allow getting multiple file descriptors from a single filesystem entry, which reduces namespace pollution compared to creating multiple device files:

    ./anonymous_inode.sh
    echo $?

Outcome: the test passes:

    0

Sources:

- kernel_modules/anonymous_inode.c

- lkmc/anonymous_inode.h

- userland/kernel_modules/anonymous_inode.c

- rootfs_overlay/lkmc/anonymous_inode.sh

This example gets an anonymous inode via ioctl from a debugfs entry by using `anon_inode_getfd`.

Reads to that inode return the sequence: `1`, `10`, `100`, …​ `10000000`, `1`, `100`, …​

Bibliography: https://stackoverflow.com/questions/4508998/what-is-an-anonymous-inode-in-linux/44388030#44388030