~ubuntu-branches/ubuntu/saucy/manpages/saucy

« back to all changes in this revision

Viewing changes to man3/makedev.3

  • Committer: Bazaar Package Importer
  • Author(s): Joey Schulze
  • Date: 2008-12-13 15:28:58 UTC
  • mfrom: (1.1.37 upstream) (2.1.13 sid)
  • Revision ID: james.westby@ubuntu.com-20081213152858-06ey2s94bhc09owg
* New upstream source
* Avoid distribution of more up-to-date pthread manpages that are
  currently also provided by glibc-doc:
  . pthread_cleanup_push_defer_np(3)
  . pthread_cleanup_pop_restore_np(3)

Show diffs side-by-side

added added

removed removed

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