OpenBSD manual page server

Manual Page Search Parameters

MAKEDEV(3) Library Functions Manual MAKEDEV(3)

makedev, major, minorcreate or extract device numbers

#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);

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 () macro is used to combine a major and minor device number into a form suitable for use with the mknod(2) system call.

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

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

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.

mknod(2), intro(4)

The makedev(), major(), and minor() macros are not standardized by IEEE Std 1003.1 (“POSIX.1”) but are available on most systems.

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

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

January 25, 2019 OpenBSD-current