MAKEDEV(3)

NAME
makedev, major, minor - create or extract device numbers

SYNOPSIS
#include <sys/types.h>
dev_t
makedev(unsigned int maj, unsigned int min);
unsigned int
major(dev_t dev);
unsigned int
minor(dev_t dev);

DESCRIPTION
On OpenBSD, all devices on the system are assigned a unique number which consists of a major and minor component. Typically, the major number identifies the kind of device and the minor number identifies a specific instance of the device.

The makedev() macro is used to combine a major and minor device number into a form suitable for use with the mknod(2) system call.

The major() macro extracts the major number from the specified device number.

The minor() macro extracts the minor number from the specified device number.

RETURN VALUES
The makedev() macro returns a combined device number from the specified major and minor numbers.

The major() macro returns the major number corresponding to the specified device number.

The minor() macro returns the minor number corresponding to the specified device number.

SEE ALSO
mknod(2), intro(4)

STANDARDS
The makedev(), major(), and minor() macros are not standardized by p1003.1 but are available on most systems.

HISTORY
The makedev(), major(), and minor() macros first appeared in AT&T UNIX.

CAVEATS
On some systems, makedev(), major(), and minor() are implemented as functions rather than macros.