makedev(3C) manual page
Table of Contents
makedev, major, minor - manage a device number
#include <sys/types.h>
#include <sys/mkdev.h>
dev_t makedev(major_t maj, minor_t min);
major_t major(dev_t device);
minor_t
minor(dev_t device);
MT-Safe
The makedev() routine returns
a formatted device number on success and NODEV
on failure. maj is the major
number. min is the minor number. makedev() can be used to create a device
number for input to mknod(2)
.
The major() routine returns the major number
component from device.
The minor() routine returns the minor number component
from device.
On failure, NODEV
is returned and errno is set
to indicate the error.
makedev() will fail if one or more of the following
are true:
- EINVAL
- One or both of the arguments maj and min is too large.
- EINVAL
- The device number created from maj and min is NODEV
.
major() will
fail if one or more of the following are true:
- EINVAL
- The device argument
is NODEV
.
- EINVAL
- The major number component of device is too large.
minor()
will fail if the following is true:
- EINVAL
- The device argument is NODEV
.
mknod(2)
, stat(2)
Table of Contents