share/mk/: Remove unused variable
[man-pages.git] / man3 / makedev.3
blob7fd748e5fdba02b53134c68f0f15b4b6b8f7e91b
1 '\" t
2 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
3 .\"     <mtk.manpages@gmail.com>
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH makedev 3 (date) "Linux man-pages (unreleased)"
8 .SH NAME
9 makedev, major, minor \- manage a device number
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ", " \-lc )
13 .SH SYNOPSIS
14 .nf
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 );
21 .fi
22 .SH DESCRIPTION
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
27 .IR dev_t .
29 Given major and minor device IDs,
30 .BR makedev ()
31 combines these to produce a device ID, returned as the function result.
32 This device ID can be given to
33 .BR mknod (2),
34 for example.
36 The
37 .BR major ()
38 and
39 .BR minor ()
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
44 .BR stat (2).
45 .SH ATTRIBUTES
46 For an explanation of the terms used in this section, see
47 .BR attributes (7).
48 .TS
49 allbox;
50 lbx lb lb
51 l l l.
52 Interface       Attribute       Value
54 .na
55 .nh
56 .BR makedev (),
57 .BR major (),
58 .BR minor ()
59 T}      Thread safety   MT-Safe
60 .TE
61 .SH VERSIONS
62 The BSDs expose the definitions for these macros via
63 .IR <sys/types.h> .
64 .SH STANDARDS
65 None.
66 .SH HISTORY
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.
72 Since glibc 2.3.3,
73 they have been aliases for three GNU-specific functions:
74 .BR gnu_dev_makedev (),
75 .BR gnu_dev_major (),
76 and
77 .BR gnu_dev_minor ().
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
82 .I <sys/types.h>
83 if suitable feature test macros are defined.
84 However, this behavior was deprecated in glibc 2.25,
85 .\" glibc commit dbab6577c6684c62bd2521c1c29dc25c3cac966f
86 and since glibc 2.28,
87 .\" glibc commit e16deca62e16f645213dffd4ecd1153c37765f17
88 .I <sys/types.h>
89 no longer provides these definitions.
90 .SH SEE ALSO
91 .BR mknod (2),
92 .BR stat (2)