summaryrefslogtreecommitdiff
path: root/share/man/man3/makedev.3
blob: 9a85d6c10d948770b5c887f0fd04f5f19c1be9ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
.\"	$OpenBSD: makedev.3,v 1.1 2014/10/13 17:27:00 millert Exp $
.\"
.\" Copyright (c) 2014 Todd C. Miller <Todd.Miller@courtesan.com>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: October 13 2014 $
.Dt MAKEDEV 3
.Os
.Sh NAME
.Nm makedev ,
.Nm major ,
.Nm minor
.Nd create or extract device numbers
.Sh SYNOPSIS
.In sys/types.h
.Ft dev_t
.Fn makedev "unsigned int maj" "unsigned int min"
.Ft unsigned int
.Fn major "dev_t dev"
.Ft unsigned int
.Fn minor "dev_t dev"
.Sh DESCRIPTION
On
.Ox ,
all devices on the system are assigned a unique number which consists
of a major and minor component.
Typically, the major number identifies the kind of device and
the minor number identifies a specific instance of the device.
.Pp
The
.Fn makedev
macro is used to combine a major and minor device number into
a form suitable for use with the
.Xr mknod 2
system call.
.Pp
The
.Fn major
macro extracts the major number from the specified device number.
.Pp
The
.Fn minor
macro extracts the minor number from the specified device number.
.Sh RETURN VALUES
The
.Fn makedev
macro returns a combined device number from the specified major and
minor numbers.
.Pp
The
.Fn major
macro returns the major number corresponding to the specified device number.
.Pp
The
.Fn minor
macro returns the minor number corresponding to the specified device number.
.Sh SEE ALSO
.Xr mknod 2 ,
.Xr intro 4
.Sh STANDARDS
The
.Fn makedev ,
.Fn major ,
and
.Fn minor
macros are not standardized by
.St -p1003.1
but are available on most systems.
.Sh HISTORY
The
.Fn makedev ,
.Fn major ,
and
.Fn minor
macros first appeared in
.At v7 .
.Sh CAVEATS
On some systems,
.Fn makedev ,
.Fn major ,
and
.Fn minor
are implemented as functions rather than macros.