2008-12-01 17:27:03 +00:00
|
|
|
.\" 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.
|
|
|
|
.\"
|
accept.2, clone.2, dup.2, fallocate.2, pipe.2, readahead.2, sched_setaffinity.2, unshare.2, CPU_SET.3, endian.3, euidaccess.3, fexecve.3, getpt.3, getpw.3, getumask.3, getutmp.3, gnu_get_libc_version.3, makedev.3, matherr.3, mbsnrtowcs.3, memfrob.3, pthread_attr_setaffinity_np.3, pthread_getattr_np.3, pthread_setaffinity_np.3, pthread_tryjoin_np.3, tcgetsid.3, wcscasecmp.3, wcsncasecmp.3, wcsnlen.3, wcsnrtombs.3, wcswidth.3, rtld-audit.7: SYNOPSIS: Add reference to feature_test_macros(7)
These pages specify feature test macros in the function
prototypes. Add a reference to feature_test_macros(7),
so that readers are pointed to the information that
feature test macros must be defined before including
*any* header file.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-09-10 05:06:22 +00:00
|
|
|
.TH MAKEDEV 3 2010-09-10 "Linux" "Linux Programmer's Manual"
|
2008-12-01 17:27:03 +00:00
|
|
|
.SH NAME
|
|
|
|
makedev, major, minor \- manage a device number
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
accept.2, clone.2, dup.2, fallocate.2, pipe.2, readahead.2, sched_setaffinity.2, unshare.2, CPU_SET.3, endian.3, euidaccess.3, fexecve.3, getpt.3, getpw.3, getumask.3, getutmp.3, gnu_get_libc_version.3, makedev.3, matherr.3, mbsnrtowcs.3, memfrob.3, pthread_attr_setaffinity_np.3, pthread_getattr_np.3, pthread_setaffinity_np.3, pthread_tryjoin_np.3, tcgetsid.3, wcscasecmp.3, wcsncasecmp.3, wcsnlen.3, wcsnrtombs.3, wcswidth.3, rtld-audit.7: SYNOPSIS: Add reference to feature_test_macros(7)
These pages specify feature test macros in the function
prototypes. Add a reference to feature_test_macros(7),
so that readers are pointed to the information that
feature test macros must be defined before including
*any* header file.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-09-10 05:06:22 +00:00
|
|
|
.BR "#define _BSD_SOURCE" " /* See feature_test_macros(7) */"
|
2009-05-02 03:43:25 +00:00
|
|
|
.B #include <sys/types.h>
|
2008-12-01 17:27:03 +00:00
|
|
|
|
|
|
|
.BI "dev_t makedev(int " maj ", int " min );
|
|
|
|
|
2012-04-29 23:26:56 +00:00
|
|
|
.BI "unsigned int major(dev_t " dev );
|
|
|
|
.BI "unsigned int minor(dev_t " dev );
|
2008-12-01 17:27:03 +00:00
|
|
|
|
|
|
|
.fi
|
|
|
|
.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
|
2010-11-01 06:27:20 +00:00
|
|
|
.BR makedev (),
|
|
|
|
.BR major (),
|
2008-12-01 17:27:03 +00:00
|
|
|
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:
|
2010-11-01 05:59:37 +00:00
|
|
|
.BR gnu_dev_makedev (),
|
|
|
|
.BR gnu_dev_major (),
|
2008-12-01 17:27:03 +00:00
|
|
|
and
|
2010-11-01 05:59:37 +00:00
|
|
|
.BR gnu_dev_minor ().
|
2008-12-01 17:27:03 +00:00
|
|
|
The latter names are exported, but the traditional names are more portable.
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR mknod (2),
|
|
|
|
.BR stat (2)
|