[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    makedev(3C) manual page Table of Contents

Name

makedev, major, minor - manage a device number

Synopsis


#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-Level

MT-Safe

Description

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.

Return Values

On failure, NODEV is returned and errno is set to indicate the error.

Errors

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 .

See Also

mknod(2) , stat(2)


Table of Contents