---
name: "DEVICE_ATTACH"
section: "9"
platform: "linux"
package: "freebsd-manpages"
version: "6.0-5"
release: "Debian 4.0 (Etch)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/DEVICE_ATTACH"
---

# DEVICE\_ATTACH(9)

attach a device

## NAME

**DEVICE\_ATTACH** – attach a device

## SYNOPSIS

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

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

*int*\

**DEVICE\_ATTACH**(*device\_t dev*);

## DESCRIPTION

Attach a device to the system after the **DEVICE\_PROBE**() method has been called and has indicated that the device exists. The **DEVICE\_ATTACH**() method should initialize the hardware and allocate other system resources (such as devfs(5) entries).

Devices which implement busses should use this method to probe for the existence of devices attached to the bus and add them as children. If this is combined with the use of [bus\_generic\_attach(9)](/bus_generic_attach/9.md) the child devices will be automatically probed and attached.

## RETURN VALUES

Zero is returned on success, otherwise an appropriate error is returned.

## SEE ALSO

devfs(5), [device(9)](/device/9.md), [DEVICE\_DETACH(9)](/DEVICE_DETACH/9.md), [DEVICE\_IDENTIFY(9)](/DEVICE_IDENTIFY/9.md), [DEVICE\_PROBE(9)](/DEVICE_PROBE/9.md), [DEVICE\_SHUTDOWN(9)](/DEVICE_SHUTDOWN/9.md)

## AUTHORS

This manual page was written by Doug Rabson ⟨dfr@FreeBSD.org⟩.
