diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2008-12-01 12:27:03 -0500 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2008-12-05 22:28:54 -0500 |
| commit | 47a0131ab7a7cdea13c84cc40c6e4a4272772455 (patch) | |
| tree | 0252d2081a8462dab7de6c4c657c0da805e0a94f | |
| parent | 857842b0cb2bce958e3201f9d8fc31d49a24bf87 (diff) | |
| download | man-pages-47a0131ab7a7cdea13c84cc40c6e4a4272772455.tar.gz | |
makedev.3: New page for makedev(), major(), and minor() macros
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Reviewed-by: Phil Endecott <phil_vonar_endecott@chezphil.org>
| -rw-r--r-- | man3/makedev.3 | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/man3/makedev.3 b/man3/makedev.3 new file mode 100644 index 0000000000..0568873219 --- /dev/null +++ b/man3/makedev.3 @@ -0,0 +1,83 @@ +.\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk +.\" <mtk.manpages@gmail.com> +.\" +.\" Permission is granted to make and distribute verbatim copies of this +.\" manual provided the copyright notice and this permission notice are +.\" preserved on all copies. +.\" +.\" Permission is granted to copy and distribute modified versions of this +.\" manual under the conditions for verbatim copying, provided that the +.\" entire resulting derived work is distributed under the terms of a +.\" permission notice identical to this one. +.\" +.\" Since the Linux kernel and libraries are constantly changing, this +.\" manual page may be incorrect or out-of-date. The author(s) assume no +.\" responsibility for errors or omissions, or for damages resulting from +.\" the use of the information contained herein. The author(s) may not +.\" have taken the same level of care in the production of this manual, +.\" which is licensed free of charge, as they might when working +.\" professionally. +.\" +.\" Formatted or processed versions of this manual, if unaccompanied by +.\" the source, must acknowledge the copyright and authors of this work. +.\" +.TH MAKEDEV 3 2008-12-01 "Linux" "Linux Programmer's Manual" +.SH NAME +makedev, major, minor \- manage a device number +.SH SYNOPSIS +.nf +.B #define _BSD_SOURCE +.B #define <sys/types.h> + +.BI "dev_t makedev(int " maj ", int " min ); + +.BI "int major(dev_t " dev ); +.BI "int minor(dev_t " dev ); + +.fi +.\" FIXME Add links +.SH DESCRIPTION +A device ID consists of two parts: +a major ID, identifying the class of the device, +and a minor ID, identifying a specific instance of a device in that class. +A device ID is represented using the type +.IR dev_t . + +Given major and minor device IDs, +.BR makedev () +combines these to produce a device ID, returned as the function result. +This device ID can be given to +.BR mknod (2), +for example. + +The +.BR major () +and +.BR minor () +functions perform the converse task: given a device ID, +they return, respectively, the major and minor components. +These macros can be useful to, for example, +decompose the device IDs in the structure returned by +.BR stat (2). +.SH "CONFORMING TO" +The +.BR makedev () +.BR major () +and +.BR minor () +functions are not specified in POSIX.1, +but are present on many other systems. +.\" The BSDs, HP-UX, Solaris, AIX, Irix +.SH NOTES +These interfaces are defined as macros. +Since glibc 2.3.3, +they have been aliases for three GNU-specific functions: +.BR gnu_dev_makedev (3), +.BR gnu_dev_major (3), +and +.BR gnu_dev_minor (3). +The latter names are exported, but the traditional names are more portable. +.SH "SEE ALSO" +.BR mknod (2), +.BR stat (2) +.\" FIXME -- add SEE ALSO's from those pages. |
