kinfo_getallproc(3)

kinfo_getallproc3

Function for getting process information of all processes from kernel

Usage

#include <sys/types.h>

#include <sys/user.h>

#include <libutil.h>

struct kinfo_proc *

kinfo_getallproc(int *cntp);

Library

System Utilities Library (libutil, -lutil)

Overview

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) 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) and must be freed by the caller with a call to free(3). On failure the kinfo_getallproc() function returns NULL.

Releases

34 releases since FreeBSD 9.0-RELEASE; the text changed 20 times.

  1. 9.0
  2. 9.1
  3. 9.2
  4. 9.3
  5. 10.0
  6. 10.1
  7. 10.2
  8. 10.3
  9. 10.4
  10. 11.0
  11. 11.1
  12. 11.2
  13. 11.3
  14. 11.4
  15. 12.0
  16. 12.1
  17. 12.2
  18. 12.3
  19. 12.4
  20. 13.0–13.2
  21. 13.3–16.0

History

The kinfo_getallproc() function first appeared in FreeBSD 8.3.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.