makedev(3C)


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

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.

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.

References

mknod(2), stat(2)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004