|MAKEDEV(3)||Linux Programmer's Manual||MAKEDEV(3)|
dev_t makedev(unsigned int maj, unsigned int min);
unsigned int major(dev_t dev); unsigned int minor(dev_t dev);
Given major and minor device IDs, makedev() combines these to produce a device ID, returned as the function result. This device ID can be given to mknod(2), for example.
The major() and minor() functions perform the converse task: given a device ID, they return, respectively, the major and minor components. These macros can be useful to, for example, decompose the device IDs in the structure returned by stat(2).
|makedev (), major (), minor ()||Thread safety||MT-Safe|
The BSDs expose the definitions for these macros via <sys/types.h>. Depending on the version, glibc also exposes definitions for these macros from that header file if suitable feature test macros are defined. However, this behavior was deprecated in glibc 2.25, and since glibc 2.28, <sys/types.h> no longer provides these definitions.