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

# device\_has\_children(9)

examine devices connected to a device

Part of [device\_get\_children(9)](/device_get_children/9.md).

## NAME

**device\_get\_children**, **device\_has\_children** – examine devices connected to a device

## SYNOPSIS

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

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

*int*\

**device\_get\_children**(*device\_t dev*, *device\_t \*\*devlistp*, *int \*devcountp*);

*bool*\

**device\_has\_children**(*device\_t dev*);

## DESCRIPTION

The **device\_get\_children** function retrieves a list of all device instances currently connected to *dev*. It returns the list in *\*devlistp* and the count in *\*devcountp*. The memory allocated for the list should be freed using **free**(*\*devlistp*, *M\_TEMP*). *devlistp* and *devcountp* are not changed when an error is returned.

As a special case, if *devlistp* is null, no memory is allocated but the count is still returned in *\*devcountp*.

The **device\_has\_children** function returns true if *dev* has at least one child and false if it has none.

## RETURN VALUES

The **device\_get\_children** function returns zero on success and an appropriate error otherwise. The **device\_has\_children** function returns true if the specified device has at least one child and false otherwise.

## SEE ALSO

[devclass(9)](/devclass/9.md), [device(9)](/device/9.md)

## AUTHORS

This manual page was written by Doug Rabson ⟨*dfr@FreeBSD.org*⟩ and Dag-Erling Smørgrav ⟨*des@FreeBSD.org*⟩.
