---
name: "OF_child"
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/OF_child"
---

# OF\_child(9)

navigate device tree

## NAME

**OF\_child**, **OF\_parent**, **OF\_peer** – navigate device tree

## SYNOPSIS

**#include \<dev/ofw/ofw\_bus.h\>**

**#include \<dev/ofw/ofw\_bus\_subr.h\>**

*phandle\_t*\

**OF\_child**(*phandle\_t node*);

*phandle\_t*\

**OF\_parent**(*phandle\_t node*);

*phandle\_t*\

**OF\_peer**(*phandle\_t node*);

## DESCRIPTION

**OF\_child**() returns the phandle value of the first child of the *node*. Zero is returned if there are no child nodes.

**OF\_parent**() returns the phandle for the parent of the *node*. Zero is returned if *node* is the root node.

**OF\_peer**() returns the phandle value of the next sibling of the *node*. Zero is returned if there is no sibling node.

## EXAMPLES

```
phandle_t node, child;
 ...
for (child = OF_child(node); child != 0; child = OF_peer(child) {
	...
}
```

## SEE ALSO

[OF\_finddevice(9)](/OF_finddevice/9.md)

## AUTHORS

This manual page was written by Oleksandr Tymoshenko ⟨*gonzo@FreeBSD.org*⟩.
