161 lines
3.9 KiB
HTML
161 lines
3.9 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of MAKEDEV</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>MAKEDEV</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2018-04-30<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
makedev, major, minor - manage a device number
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/sys/sysmacros.h">sys/sysmacros.h</A>></B>
|
|
|
|
<B>dev_t makedev(unsigned int </B><I>maj</I><B>, unsigned int </B><I>min</I><B>);</B>
|
|
|
|
<B>unsigned int major(dev_t </B><I>dev</I><B>);</B>
|
|
<B>unsigned int minor(dev_t </B><I>dev</I><B>);</B>
|
|
</PRE>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
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
|
|
<I>dev_t</I>.
|
|
|
|
<P>
|
|
|
|
Given major and minor device IDs,
|
|
<B>makedev</B>()
|
|
|
|
combines these to produce a device ID, returned as the function result.
|
|
This device ID can be given to
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mknod">mknod</A></B>(2),
|
|
|
|
for example.
|
|
<P>
|
|
|
|
The
|
|
<B>major</B>()
|
|
|
|
and
|
|
<B>minor</B>()
|
|
|
|
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
|
|
<B><A HREF="/cgi-bin/man/man2html?2+stat">stat</A></B>(2).
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>makedev</B>(),
|
|
|
|
<B>major</B>(),
|
|
|
|
<B>minor</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
The
|
|
<B>makedev</B>(),
|
|
|
|
<B>major</B>(),
|
|
|
|
and
|
|
<B>minor</B>()
|
|
|
|
functions are not specified in POSIX.1,
|
|
but are present on many other systems.
|
|
|
|
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
These interfaces are defined as macros.
|
|
Since glibc 2.3.3,
|
|
they have been aliases for three GNU-specific functions:
|
|
<B>gnu_dev_makedev</B>(),
|
|
|
|
<B>gnu_dev_major</B>(),
|
|
|
|
and
|
|
<B>gnu_dev_minor</B>().
|
|
|
|
The latter names are exported, but the traditional names are more portable.
|
|
<P>
|
|
|
|
The BSDs expose the definitions for these macros via
|
|
<I><<A HREF="file:///usr/include/sys/types.h">sys/types.h</A>></I>.
|
|
|
|
Depending on the version,
|
|
glibc also exposes definitions for these macros from that
|
|
header file if suitable feature test macros are defined.
|
|
However, this behavior was deprecated in glibc 2.25,
|
|
|
|
and since glibc 2.28,
|
|
|
|
<I><<A HREF="file:///usr/include/sys/types.h">sys/types.h</A>></I>
|
|
|
|
no longer provides these definitions.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mknod">mknod</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+stat">stat</A></B>(2)
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="4"><A HREF="#lbAE">ATTRIBUTES</A><DD>
|
|
<DT id="5"><A HREF="#lbAF">CONFORMING TO</A><DD>
|
|
<DT id="6"><A HREF="#lbAG">NOTES</A><DD>
|
|
<DT id="7"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
<DT id="8"><A HREF="#lbAI">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:47 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|