2 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .TH makedev 3 (date) "Linux man-pages (unreleased)"
9 makedev, major, minor \- manage a device number
12 .RI ( libc ", " \-lc )
15 .B #include <sys/sysmacros.h>
17 .BI "dev_t makedev(unsigned int " maj ", unsigned int " min );
19 .BI "unsigned int major(dev_t " dev );
20 .BI "unsigned int minor(dev_t " dev );
23 A device ID consists of two parts:
24 a major ID, identifying the class of the device,
25 and a minor ID, identifying a specific instance of a device in that class.
26 A device ID is represented using the type
29 Given major and minor device IDs,
31 combines these to produce a device ID, returned as the function result.
32 This device ID can be given to
40 functions perform the converse task: given a device ID,
41 they return, respectively, the major and minor components.
42 These macros can be useful to, for example,
43 decompose the device IDs in the structure returned by
46 For an explanation of the terms used in this section, see
52 Interface Attribute Value
59 T} Thread safety MT-Safe
62 The BSDs expose the definitions for these macros via
67 BSD, HP-UX, Solaris, AIX, Irix.
68 .\" The header location is inconsistent:
69 .\" Could be sys/mkdev.h, sys/sysmacros.h, or sys/types.h.
71 These interfaces are defined as macros.
73 they have been aliases for three GNU-specific functions:
74 .BR gnu_dev_makedev (),
78 The latter names are exported, but the traditional names are more portable.
80 Depending on the version,
81 glibc also exposes definitions for these macros from
83 if suitable feature test macros are defined.
84 However, this behavior was deprecated in glibc 2.25,
85 .\" glibc commit dbab6577c6684c62bd2521c1c29dc25c3cac966f
87 .\" glibc commit e16deca62e16f645213dffd4ecd1153c37765f17
89 no longer provides these definitions.