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

# kstack\_contains(9)

determine if an address range lies within the kernel stack for a thread

## NAME

**kstack\_contains** – determine if an address range lies within the kernel stack for a thread

## SYNOPSIS

**#include \<machine/stack.h\>**

*bool*\

**kstack\_contains**(*struct thread \*td*, *vm\_offset\_t va*, *size\_t len*);

## DESCRIPTION

This function can be used to determine whether a given address range falls within the kernel stack for the thread pointed to by *td*.

## RETURN VALUES

The function **kstack\_contains**() returns true if the range of addresses\[ *va*..(*va*+ *len*-1)\] (both addresses inclusive) lies within the kernel stack for the thread pointed to by argument *td*, or returns false otherwise.

## ERRORS

This function does not return an error.

## SEE ALSO

[kproc(9)](/kproc/9.md), [kthread(9)](/kthread/9.md)
