1MAKEDEV(3)                 Linux Programmer's Manual                MAKEDEV(3)
2
3
4

NAME

6       makedev, major, minor - manage a device number
7

SYNOPSIS

9       #define _BSD_SOURCE             /* See feature_test_macros(7) */
10       #include <sys/types.h>
11
12       dev_t makedev(int maj, int min);
13
14       unsigned int major(dev_t dev);
15       unsigned int minor(dev_t dev);
16

DESCRIPTION

18       A device ID consists of two parts: a major ID, identifying the class of
19       the device, and a minor ID, identifying a specific instance of a device
20       in that class.  A device ID is represented using the type dev_t.
21
22       Given major and minor device IDs, makedev() combines these to produce a
23       device ID, returned as the function result.   This  device  ID  can  be
24       given to mknod(2), for example.
25
26       The  major()  and  minor() functions perform the converse task: given a
27       device ID, they return, respectively, the major and  minor  components.
28       These macros can be useful to, for example, decompose the device IDs in
29       the structure returned by stat(2).
30

CONFORMING TO

32       The makedev(), major(), and minor()  functions  are  not  specified  in
33       POSIX.1, but are present on many other systems.
34

NOTES

36       These  interfaces  are defined as macros.  Since glibc 2.3.3, they have
37       been  aliases  for  three  GNU-specific  functions:  gnu_dev_makedev(),
38       gnu_dev_major(),  and  gnu_dev_minor().  The latter names are exported,
39       but the traditional names are more portable.
40

SEE ALSO

42       mknod(2), stat(2)
43

COLOPHON

45       This page is part of release 3.53 of the Linux  man-pages  project.   A
46       description  of  the project, and information about reporting bugs, can
47       be found at http://www.kernel.org/doc/man-pages/.
48
49
50
51Linux                             2012-05-10                        MAKEDEV(3)
Impressum