kldnext(2)

kldnext2

Return the fileid of the next kld file

Usage

#include <sys/linker.h>

int

kldnext(int fileid);

Library

Standard C Library (libc, -lc)

Overview

The kldnext() system call returns the fileid of the next kld file (that is, the one after fileid) or 0 if fileid is the last file loaded. To get the fileid of the first kld file, pass fileid of 0 to kldnext().

Return values

The kldnext() system call returns the fileid of the next kld file or 0 if successful. Otherwise kldnext() returns the value -1 and sets the global variable errno to indicate the error.

Errors

The only error set by kldnext() is ENOENT, which is set when fileid refers to a kld file that does not exist (is not loaded).

Releases

74 releases since FreeBSD 3.3-RELEASE; the text changed 46 times.

  1. 3.3
  2. 3.4
  3. 3.5–3.5.1
  4. 4.0
  5. 4.1–4.1.1
  6. 4.2
  7. 4.3
  8. 4.4
  9. 4.5–4.11
  10. 5.0
  11. 5.1–5.2.1
  12. 5.3–5.5
  13. 6.0
  14. 6.1–6.3
  15. 6.4
  16. 7.0
  17. 7.1
  18. 7.2
  19. 7.3
  20. 7.4
  21. 8.0
  22. 8.1
  23. 8.2
  24. 8.3
  25. 8.4
  26. 9.0
  27. 9.1
  28. 9.2
  29. 9.3
  30. 10.0
  31. 10.1
  32. 10.2
  33. 10.3
  34. 10.4
  35. 11.0
  36. 11.1
  37. 11.2
  38. 11.3
  39. 11.4
  40. 12.0
  41. 12.1
  42. 12.2
  43. 12.3
  44. 12.4
  45. 13.0–13.2
  46. 13.3–14.2
  47. 14.3–16.0

History

The kld interface first appeared in FreeBSD 3.0.

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