From 9c53985f97b2b6b5f25876e5fe453bf43170fd1a Mon Sep 17 00:00:00 2001 From: jruoho Date: Tue, 14 Dec 2010 17:09:27 +0000 Subject: [PATCH] Add a manual page for the makedev(), major(), and minor() macros. Taken from FreeBSD. Written by Ed Schouten. --- distrib/sets/lists/comp/mi | 11 +++++- share/man/man3/Makefile | 6 ++- share/man/man3/makedev.3 | 75 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 share/man/man3/makedev.3 diff --git a/distrib/sets/lists/comp/mi b/distrib/sets/lists/comp/mi index 35a77b077eae..82c938b67055 100644 --- a/distrib/sets/lists/comp/mi +++ b/distrib/sets/lists/comp/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1541 2010/12/13 21:15:30 pooka Exp $ +# $NetBSD: mi,v 1.1542 2010/12/14 17:09:27 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -7235,7 +7235,9 @@ ./usr/share/man/cat3/magic_load.0 comp-c-catman .cat ./usr/share/man/cat3/magic_open.0 comp-c-catman .cat ./usr/share/man/cat3/magic_setflags.0 comp-c-catman .cat +./usr/share/man/cat3/major.0 comp-c-catman .cat ./usr/share/man/cat3/makecontext.0 comp-c-catman .cat +./usr/share/man/cat3/makedev.0 comp-c-catman .cat ./usr/share/man/cat3/malloc.0 comp-c-catman .cat ./usr/share/man/cat3/man.0 comp-mdocml-catman .cat ./usr/share/man/cat3/math.0 comp-c-catman .cat @@ -7290,6 +7292,7 @@ ./usr/share/man/cat3/mergesort.0 comp-c-catman .cat ./usr/share/man/cat3/meta.0 comp-c-catman .cat ./usr/share/man/cat3/mi_vector_hash.0 comp-c-catman .cat +./usr/share/man/cat3/minor.0 comp-c-catman .cat ./usr/share/man/cat3/mkdtemp.0 comp-c-catman .cat ./usr/share/man/cat3/mkstemp.0 comp-c-catman .cat ./usr/share/man/cat3/mktemp.0 comp-c-catman .cat @@ -13199,7 +13202,9 @@ ./usr/share/man/html3/magic_load.html comp-c-htmlman html ./usr/share/man/html3/magic_open.html comp-c-htmlman html ./usr/share/man/html3/magic_setflags.html comp-c-htmlman html +./usr/share/man/html3/major.html comp-c-htmlman html ./usr/share/man/html3/makecontext.html comp-c-htmlman html +./usr/share/man/html3/makedev.html comp-c-htmlman html ./usr/share/man/html3/malloc.html comp-c-htmlman html ./usr/share/man/html3/man.html comp-mdocml-htmlman html ./usr/share/man/html3/math.html comp-c-htmlman html @@ -13253,6 +13258,7 @@ ./usr/share/man/html3/mergesort.html comp-c-htmlman html ./usr/share/man/html3/meta.html comp-c-htmlman html ./usr/share/man/html3/mi_vector_hash.html comp-c-htmlman html +./usr/share/man/html3/minor.html comp-c-htmlman html ./usr/share/man/html3/mkdtemp.html comp-c-htmlman html ./usr/share/man/html3/mkstemp.html comp-c-htmlman html ./usr/share/man/html3/mktemp.html comp-c-htmlman html @@ -19149,7 +19155,9 @@ ./usr/share/man/man3/magic_load.3 comp-c-man .man ./usr/share/man/man3/magic_open.3 comp-c-man .man ./usr/share/man/man3/magic_setflags.3 comp-c-man .man +./usr/share/man/man3/major.3 comp-c-man .man ./usr/share/man/man3/makecontext.3 comp-c-man .man +./usr/share/man/man3/makedev.3 comp-c-man .man ./usr/share/man/man3/malloc.3 comp-c-man .man ./usr/share/man/man3/man.3 comp-mdocml-man .man ./usr/share/man/man3/math.3 comp-c-man .man @@ -19204,6 +19212,7 @@ ./usr/share/man/man3/mergesort.3 comp-c-man .man ./usr/share/man/man3/meta.3 comp-c-man .man ./usr/share/man/man3/mi_vector_hash.3 comp-c-man .man +./usr/share/man/man3/minor.3 comp-c-man .man ./usr/share/man/man3/mkdtemp.3 comp-c-man .man ./usr/share/man/man3/mkstemp.3 comp-c-man .man ./usr/share/man/man3/mktemp.3 comp-c-man .man diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile index 112084aeb6a2..7937337b4ed6 100644 --- a/share/man/man3/Makefile +++ b/share/man/man3/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.57 2010/10/24 06:57:04 jruoho Exp $ +# $NetBSD: Makefile,v 1.58 2010/12/14 17:09:27 jruoho Exp $ # @(#)Makefile 8.2 (Berkeley) 12/13/93 MAN= _DIAGASSERT.3 __CONCAT.3 __UNCONST.3 CMSG_DATA.3 \ @@ -6,7 +6,7 @@ MAN= _DIAGASSERT.3 __CONCAT.3 __UNCONST.3 CMSG_DATA.3 \ dlfcn.3 dl_iterate_phdr.3 end.3 \ fast_divide32.3 ffs32.3 gcq.3 \ ilog2.3 intro.3 inttypes.3 iso646.3 \ - offsetof.3 queue.3 rbtree.3 sigevent.3 \ + makedev.3 offsetof.3 queue.3 rbtree.3 sigevent.3 \ stdarg.3 stdbool.3 stddef.3 stdint.3 stdlib.3 sysexits.3 \ tgmath.3 timeradd.3 timeval.3 tree.3 types.3 varargs.3 @@ -35,6 +35,8 @@ MLINKS+=fast_divide32.3 fast_divide32_prepare.3 \ MLINKS+=ffs32.3 ffs64.3 \ ffs32.3 fls32.3 \ ffs32.3 fls64.3 +MLINKS+=makedev.3 major.3 \ + makedev.3 minor.3 MLINKS+=gcq.3 GCQ_INIT.3 \ gcq.3 GCQ_INIT_HEAD.3 \ gcq.3 gcq_init.3 \ diff --git a/share/man/man3/makedev.3 b/share/man/man3/makedev.3 new file mode 100644 index 000000000000..a9ae8323a511 --- /dev/null +++ b/share/man/man3/makedev.3 @@ -0,0 +1,75 @@ +.\" $NetBSD: makedev.3,v 1.1 2010/12/14 17:09:27 jruoho Exp $ +.\" +.\" Copyright (c) 2008 Ed Schouten +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD: src/share/man/man3/makedev.3,v 1.2 2008/09/28 20:26:16 ed Exp $ +.\" +.Dd December 14, 2010 +.Dt MAKEDEV 3 +.Os +.Sh NAME +.Nm makedev , +.Nm major , +.Nm minor +.Nd device number conversion +.Sh SYNOPSIS +.In sys/types.h +.Ft dev_t +.Fn makedev "int major" "int minor" +.Ft int +.Fn major "dev_t dev" +.Ft int +.Fn minor "dev_t dev" +.Sh DESCRIPTION +The +.Fn makedev +macro allows a unique device number to be generated based on its +.Fa major +and +.Fa minor +number. +The +.Fn major +and +.Fn minor +macros can be used to obtain the original numbers from the device number +.Fa dev . +.Pp +All block and character devices are uniquely +identified by a pair of major and minor numbers. +The major number refers to a certain device class (e.g. disks, TTYs) +while the minor number identifies an instance within the device class. +.Sh RETURN VALUES +The +.Fn major +macro returns a device major number that has a value between 0 and 255. +The +.Fn minor +macro returns a device minor number whose value can span the complete +range of an +.Vt int . +.Sh SEE ALSO +.Xr mknod 2 , +.Xr devname 3