.\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk .\" .\" .\" %%%LICENSE_START(VERBATIM) .\" 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. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2012 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2012-05-08, Akihiro MOTOKI .\" .TH MAKEDEV 3 2014\-05\-28 Linux "Linux Programmer's Manual" .SH 名前 makedev, major, minor \- デバイス番号の操作 .SH 書式 .nf \fB#define _BSD_SOURCE\fP /* feature_test_macros(7) 参照 */ \fB#include \fP \fBdev_t makedev(unsigned int \fP\fImaj\fP\fB, unsigned int \fP\fImin\fP\fB);\fP \fBunsigned int major(dev_t \fP\fIdev\fP\fB);\fP \fBunsigned int minor(dev_t \fP\fIdev\fP\fB);\fP .fi .SH 説明 デバイス ID は、メジャー ID とマイナー ID の二つの部分から構成される。 メジャー ID はデバイスクラスの識別に使用され、マイナー ID は そのクラス内の特定のデバイスインスタンスの識別に使用される。 デバイス ID は \fIdev_t\fP 型を用いて表現される。 \fBmakedev\fP() は、指定されたメジャー ID とマイナー ID を組み合わせて デバイス ID を生成し、関数の結果として返す。 このデバイス ID は \fBmknod\fP(2) などに渡すことができる。 関数 \fBmajor\fP() と \fBminor\fP() は \fBmakedev\fP() と反対の処理を行う。 つまり、device ID を渡すと、それぞれメジャー ID 部分とマイナー ID 部分 を返す。これらのマクロは、例えば、 \fBstat\fP(2) が返す構造体に含まれる デバイス ID を分解する場合などで役に立つ。 .SH 準拠 .\" The BSDs, HP-UX, Solaris, AIX, Irix 関数 \fBmakedev\fP(), \fBmajor\fP(), \fBminor\fP() は POSIX.1 では規定されていないが、他の多くのシステムにも存在する。 .SH 注意 これらのインターフェースはマクロとして定義されている。 glibc 2.3.3 以降では、これらは GNU 固有の 3 つの関数 \fBgnu_dev_makedev\fP(), \fBgnu_dev_major\fP(), \fBgnu_dev_minor\fP() の エイリアス (別名) となっている。後者の名前がエクスポートされるが、 以前から使われている前者の名前の方が移植性がある。 .SH 関連項目 \fBmknod\fP(2), \fBstat\fP(2) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。