.\" $OpenBSD: makedev.3,v 1.2 2019/01/25 00:19:26 millert Exp $ .\" .\" Copyright (c) 2014 Todd C. Miller .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd $Mdocdate: January 25 2019 $ .Dt MAKEDEV 3 .Os .Sh NAME .Nm makedev , .Nm major , .Nm minor .Nd create or extract device numbers .Sh SYNOPSIS .In sys/types.h .Ft dev_t .Fn makedev "unsigned int maj" "unsigned int min" .Ft unsigned int .Fn major "dev_t dev" .Ft unsigned int .Fn minor "dev_t dev" .Sh DESCRIPTION On .Ox , all devices on the system are assigned a unique number which consists of a major and minor component. Typically, the major number identifies the kind of device and the minor number identifies a specific instance of the device. .Pp The .Fn makedev macro is used to combine a major and minor device number into a form suitable for use with the .Xr mknod 2 system call. .Pp The .Fn major macro extracts the major number from the specified device number. .Pp The .Fn minor macro extracts the minor number from the specified device number. .Sh RETURN VALUES The .Fn makedev macro returns a combined device number from the specified major and minor numbers. .Pp The .Fn major macro returns the major number corresponding to the specified device number. .Pp The .Fn minor macro returns the minor number corresponding to the specified device number. .Sh SEE ALSO .Xr mknod 2 , .Xr intro 4 .Sh STANDARDS The .Fn makedev , .Fn major , and .Fn minor macros are not standardized by .St -p1003.1 but are available on most systems. .Sh HISTORY The .Fn makedev , .Fn major , and .Fn minor macros first appeared in .At v7 . .Sh CAVEATS On some systems, .Fn makedev , .Fn major , and .Fn minor are implemented as functions rather than macros.