---
name: "makedev"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/major"
---

# makedev(3)

device number conversion

Part of [major(3)](/major/3.md).

## NAME

**makedev**, **major**, **minor** – device number conversion

## SYNOPSIS

**#include \<sys/types.h\>**

*dev\_t*\

**makedev**(*int major*, *int minor*);

*int*\

**major**(*dev\_t dev*);

*int*\

**minor**(*dev\_t dev*);

## DESCRIPTION

The **makedev**() macro returns a device number created from the provided *major* and *minor* number. The **major**() and **minor**() macros return the original numbers from the device number *dev*. In other words, for a value *dev* of the type *dev\_t*, and values *ma*, *mi* of the type *int*, the assertions

```
dev == makedev(major(dev), minor(dev))
```

```
ma == major(makedev(ma, mi))
```

```
mi == minor(makedev(ma, mi))
```

are valid.

In previous implementations of FreeBSD all block and character devices were uniquely identified by a pair of stable major and minor numbers. The major number referred to a certain device class (e.g. disks, TTYs) while the minor number identified an instance within the device class. Later versions of FreeBSD automatically generate a unique device number for each character device visible in */dev/*. These numbers are not divided in device classes and are not guaranteed to be stable upon reboot or driver reload.

On FreeBSD these macros are only used by utilities that need to exchange numbers with other operating systems that may use different encodings for *dev\_t*, but also applications that present these numbers to the user in a more conventional way.

## RETURN VALUES

The **major**() and **minor**() macros return numbers whose value can span the complete range of an *int*.

## SEE ALSO

[mknod(2)](/mknod/2.md), [devname(3)](/devname/3.md), [devfs(4)](/devfs/4.md)
