OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / original / man3 / makedev.3
1 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
2 .\"     <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
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.
24 .\" %%%LICENSE_END
25 .\"
26 .TH MAKEDEV 3 2014-05-28 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 makedev, major, minor \- manage a device number
29 .SH SYNOPSIS
30 .nf
31 .BR "#define _BSD_SOURCE" "             /* See feature_test_macros(7) */"
32 .B #include <sys/types.h>
33
34 .BI "dev_t makedev(unsigned int " maj ", unsigned int " min );
35
36 .BI "unsigned int major(dev_t " dev );
37 .BI "unsigned int minor(dev_t " dev );
38 .fi
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).
62 .SH CONFORMING TO
63 The
64 .BR makedev (),
65 .BR major (),
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:
75 .BR gnu_dev_makedev (),
76 .BR gnu_dev_major (),
77 and
78 .BR gnu_dev_minor ().
79 The latter names are exported, but the traditional names are more portable.
80 .SH SEE ALSO
81 .BR mknod (2),
82 .BR stat (2)
83 .SH COLOPHON
84 This page is part of release 3.79 of the Linux
85 .I man-pages
86 project.
87 A description of the project,
88 information about reporting bugs,
89 and the latest version of this page,
90 can be found at
91 \%http://www.kernel.org/doc/man\-pages/.