1 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
2 .\" <mtk.manpages@gmail.com>
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .TH MAKEDEV 3 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
8 makedev, major, minor \- manage a device number
11 .RI ( libc ", " \-lc )
14 .B #include <sys/sysmacros.h>
16 .BI "dev_t makedev(unsigned int " maj ", unsigned int " min );
18 .BI "unsigned int major(dev_t " dev );
19 .BI "unsigned int minor(dev_t " dev );
22 A device ID consists of two parts:
23 a major ID, identifying the class of the device,
24 and a minor ID, identifying a specific instance of a device in that class.
25 A device ID is represented using the type
28 Given major and minor device IDs,
30 combines these to produce a device ID, returned as the function result.
31 This device ID can be given to
39 functions perform the converse task: given a device ID,
40 they return, respectively, the major and minor components.
41 These macros can be useful to, for example,
42 decompose the device IDs in the structure returned by
45 For an explanation of the terms used in this section, see
53 Interface Attribute Value
58 T} Thread safety MT-Safe
69 functions are not specified in POSIX.1,
70 but are present on many other systems.
71 .\" The BSDs, HP-UX, Solaris, AIX, Irix.
72 .\" The header location is inconsistent:
73 .\" Could be sys/mkdev.h, sys/sysmacros.h, or sys/types.h.
75 These interfaces are defined as macros.
77 they have been aliases for three GNU-specific functions:
78 .BR gnu_dev_makedev (),
82 The latter names are exported, but the traditional names are more portable.
84 The BSDs expose the definitions for these macros via
86 Depending on the version,
87 glibc also exposes definitions for these macros from that
88 header file if suitable feature test macros are defined.
89 However, this behavior was deprecated in glibc 2.25,
90 .\" glibc commit dbab6577c6684c62bd2521c1c29dc25c3cac966f
92 .\" glibc commit e16deca62e16f645213dffd4ecd1153c37765f17
94 no longer provides these definitions.