]>
Commit | Line | Data |
---|---|---|
47a0131a MK |
1 | .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk |
2 | .\" <mtk.manpages@gmail.com> | |
3 | .\" | |
93015253 | 4 | .\" %%%LICENSE_START(VERBATIM) |
47a0131a MK |
5 | .\" Permission is granted to make and distribute verbatim copies of this |
6 | .\" manual provided the copyright notice and this permission notice are | |
7 | .\" preserved on all copies. | |
8 | .\" | |
9 | .\" Permission is granted to copy and distribute modified versions of this | |
10 | .\" manual under the conditions for verbatim copying, provided that the | |
11 | .\" entire resulting derived work is distributed under the terms of a | |
12 | .\" permission notice identical to this one. | |
13 | .\" | |
14 | .\" Since the Linux kernel and libraries are constantly changing, this | |
15 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
16 | .\" responsibility for errors or omissions, or for damages resulting from | |
17 | .\" the use of the information contained herein. The author(s) may not | |
18 | .\" have taken the same level of care in the production of this manual, | |
19 | .\" which is licensed free of charge, as they might when working | |
20 | .\" professionally. | |
21 | .\" | |
22 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
23 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 24 | .\" %%%LICENSE_END |
47a0131a | 25 | .\" |
8660ef9f | 26 | .TH MAKEDEV 3 2014-05-28 "Linux" "Linux Programmer's Manual" |
47a0131a MK |
27 | .SH NAME |
28 | makedev, major, minor \- manage a device number | |
29 | .SH SYNOPSIS | |
30 | .nf | |
86b91fdf | 31 | .BR "#define _BSD_SOURCE" " /* See feature_test_macros(7) */" |
5f6f222a | 32 | .B #include <sys/types.h> |
47a0131a | 33 | |
eb696b73 | 34 | .BI "dev_t makedev(unsigned int " maj ", unsigned int " min ); |
47a0131a | 35 | |
2540aee7 MK |
36 | .BI "unsigned int major(dev_t " dev ); |
37 | .BI "unsigned int minor(dev_t " dev ); | |
47a0131a | 38 | .fi |
47a0131a MK |
39 | .SH DESCRIPTION |
40 | A device ID consists of two parts: | |
41 | a major ID, identifying the class of the device, | |
42 | and a minor ID, identifying a specific instance of a device in that class. | |
43 | A device ID is represented using the type | |
44 | .IR dev_t . | |
45 | ||
46 | Given major and minor device IDs, | |
47 | .BR makedev () | |
48 | combines these to produce a device ID, returned as the function result. | |
49 | This device ID can be given to | |
50 | .BR mknod (2), | |
51 | for example. | |
52 | ||
53 | The | |
54 | .BR major () | |
55 | and | |
56 | .BR minor () | |
57 | functions perform the converse task: given a device ID, | |
58 | they return, respectively, the major and minor components. | |
59 | These macros can be useful to, for example, | |
60 | decompose the device IDs in the structure returned by | |
61 | .BR stat (2). | |
47297adb | 62 | .SH CONFORMING TO |
47a0131a | 63 | The |
9afb166c MK |
64 | .BR makedev (), |
65 | .BR major (), | |
47a0131a MK |
66 | and |
67 | .BR minor () | |
68 | functions are not specified in POSIX.1, | |
69 | but are present on many other systems. | |
70 | .\" The BSDs, HP-UX, Solaris, AIX, Irix | |
71 | .SH NOTES | |
72 | These interfaces are defined as macros. | |
73 | Since glibc 2.3.3, | |
74 | they have been aliases for three GNU-specific functions: | |
27d47e71 MK |
75 | .BR gnu_dev_makedev (), |
76 | .BR gnu_dev_major (), | |
47a0131a | 77 | and |
27d47e71 | 78 | .BR gnu_dev_minor (). |
47a0131a | 79 | The latter names are exported, but the traditional names are more portable. |
47297adb | 80 | .SH SEE ALSO |
47a0131a MK |
81 | .BR mknod (2), |
82 | .BR stat (2) |