---
name: "kinfo_getallproc"
section: "3"
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/kinfo_getallproc"
---

# kinfo\_getallproc(3)

function for getting process information of all processes from kernel

## NAME

**kinfo\_getallproc** – function for getting process information of all processes from kernel

## LIBRARY

System Utilities Library (libutil, -lutil)

## SYNOPSIS

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

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

**#include \<libutil.h\>**

*struct* *kinfo\_proc* *\**\

**kinfo\_getallproc**(*int \*cntp*);

## DESCRIPTION

This function is used for obtaining process information of all processes from the kernel.

The *cntp* field is a pointer containing the number of process structures returned. This function is a wrapper around [sysctl(3)](/sysctl/3.md) with the KERN\_PROC\_PROC mib. While the kernel returns a packed structure, this function expands the data into a fixed record format.

## RETURN VALUES

On success the **kinfo\_getallproc**() function returns a pointer to *cntp* *struct* *kinfo\_proc* structures as defined by ⟨sys/user.h⟩. The pointer was obtained by an internal call to [malloc(3)](/malloc/3.md) and must be freed by the caller with a call to [free(3)](/free/3.md). On failure the **kinfo\_getallproc**() function returns NULL.

## SEE ALSO

[free(3)](/free/3.md), [malloc(3)](/malloc/3.md), [sysctl(3)](/sysctl/3.md)

## HISTORY

The **kinfo\_getallproc**() function first appeared in FreeBSD 8.3.
