1makedev(3)                 Library Functions Manual                 makedev(3)
2
3
4

NAME

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

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <sys/sysmacros.h>
13
14       dev_t makedev(unsigned int maj, unsigned int min);
15
16       unsigned int major(dev_t dev);
17       unsigned int minor(dev_t dev);
18

DESCRIPTION

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

ATTRIBUTES

34       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
35       tributes(7).
36
37       ┌────────────────────────────────────────────┬───────────────┬─────────┐
38Interface                                   Attribute     Value   
39       ├────────────────────────────────────────────┼───────────────┼─────────┤
40makedev(), major(), minor()                 │ Thread safety │ MT-Safe │
41       └────────────────────────────────────────────┴───────────────┴─────────┘
42

VERSIONS

44       The BSDs expose the definitions for these macros via <sys/types.h>.
45

STANDARDS

47       None.
48

HISTORY

50       BSD, HP-UX, Solaris, AIX, Irix.
51
52       These  interfaces  are defined as macros.  Since glibc 2.3.3, they have
53       been  aliases  for  three  GNU-specific  functions:  gnu_dev_makedev(),
54       gnu_dev_major(),  and  gnu_dev_minor().  The latter names are exported,
55       but the traditional names are more portable.
56
57       Depending on the version, glibc  also  exposes  definitions  for  these
58       macros  from <sys/types.h> if suitable feature test macros are defined.
59       However, this behavior was deprecated in glibc 2.25,  and  since  glibc
60       2.28, <sys/types.h> no longer provides these definitions.
61

SEE ALSO

63       mknod(2), stat(2)
64
65
66
67Linux man-pages 6.05              2023-07-20                        makedev(3)
Impressum