Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试从 /proc/pid/stat 中的 tty_nr 属性中提取次要设备号。根据文档,据说次要设备号是 tty_nr 中 0-7 和 20-30 位的组合。如何从 tty_nr 号码中提取这些位?
已经为此目的定义了宏。使用 中定义的MAJOR()和MINOR()宏linux/kdev_t.h。
MAJOR()
MINOR()
linux/kdev_t.h