]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/makedev.3
locale.1, adjtimex.2, clone.2, fork.2, getrlimit.2, remap_file_pages.2, set_mempolicy...
[thirdparty/man-pages.git] / man3 / makedev.3
CommitLineData
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
28makedev, 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
40A device ID consists of two parts:
41a major ID, identifying the class of the device,
42and a minor ID, identifying a specific instance of a device in that class.
43A device ID is represented using the type
44.IR dev_t .
45
46Given major and minor device IDs,
47.BR makedev ()
48combines these to produce a device ID, returned as the function result.
49This device ID can be given to
50.BR mknod (2),
51for example.
52
53The
54.BR major ()
55and
56.BR minor ()
57functions perform the converse task: given a device ID,
58they return, respectively, the major and minor components.
59These macros can be useful to, for example,
60decompose the device IDs in the structure returned by
61.BR stat (2).
47297adb 62.SH CONFORMING TO
47a0131a 63The
9afb166c
MK
64.BR makedev (),
65.BR major (),
47a0131a
MK
66and
67.BR minor ()
68functions are not specified in POSIX.1,
69but are present on many other systems.
70.\" The BSDs, HP-UX, Solaris, AIX, Irix
71.SH NOTES
72These interfaces are defined as macros.
73Since glibc 2.3.3,
74they have been aliases for three GNU-specific functions:
27d47e71
MK
75.BR gnu_dev_makedev (),
76.BR gnu_dev_major (),
47a0131a 77and
27d47e71 78.BR gnu_dev_minor ().
47a0131a 79The 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)