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
10       #include <sys/types.h>
11
12       dev_t makedev(int maj, int min);
13
14       int major(dev_t dev);
15       int minor(dev_t dev);
16
17

DESCRIPTION

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

CONFORMING TO

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

NOTES

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

SEE ALSO

43       mknod(2), stat(2)
44

COLOPHON

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