man.bsd.lv manual page server

Manual Page Search Parameters

KINFO(3) Library Functions Manual KINFO(3)

kinfo_get_cpus, kinfo_get_files, kinfo_get_maxfiles, kinfo_get_net_rtstatistics, kinfo_get_openfiles, kinfo_get_sched_cputime, kinfo_get_sched_hz, kinfo_get_sched_profhz, kinfo_get_sched_stathz, kinfo_get_tty_tk_nin, kinfo_get_tty_tk_nout, kinfo_get_vfs_bufspaceinformation about the running kernel

library “libkinfo”

#include <kinfo.h>

int
kinfo_get_files(struct kinfo_file **file_buf, size_t *len);

int
kinfo_get_maxfiles(int *maxfiles);

int
kinfo_get_openfiles(int *openfiles);

int
kinfo_get_net_rtstatistics(struct rtstatistics *rts);

int
kinfo_get_cpus(int *ncpus);

int
kinfo_get_sched_cputime(struct kinfo_cputime *cputime);

int
kinfo_get_sched_hz(int *hz);

int
kinfo_get_sched_profhz(int *profhz);

int
kinfo_get_sched_stathz(int *stathz);

int
kinfo_get_tty_tk_nin(uint64_t *tk_nin);

int
kinfo_get_tty_tk_nout(uint64_t *tk_nout);

int
kinfo_get_vfs_bufspace(long *bufspace);

The () function returns the kernel's file table as a pointer to an array of kinfo_file structures in the file_buf argument. The number of elements in the array is returned in len. It is the caller's responsibility to () the array.

The () and () functions return the maximum number of files and the number of open files in the maxfiles and openfiles arguments, respectively.

The () function retrieves routing statistics from the kernel and fills out a struct rtstatistics, a pointer to which has to be specified by the caller in rts.

The () function returns the number of active CPUs in the ncpus argument.

The () function retrieves CPU time statistics from the kernel and fills out a struct kinfo_cputime, a pointer to which has to be specified by the caller in cputime.

The (), (), and () functions retrieve system clock information from the kernel and return the ci_hz, ci_profhz, and ci_stathz fields of struct kinfo_clockinfo in the hz, profhz, and stathz arguments, respectively.

The () and () functions return the total number of characters which were input and output on the system's TTYs in the tk_nin and tk_nout arguments, respectively.

The () function returns the maximum amount of memory available for VFS buffers in the bufspace argument.

Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

The kinfo_get_cpus(), kinfo_get_maxfiles(), kinfo_get_openfiles(), kinfo_get_sched_hz(), kinfo_get_sched_profhz(), kinfo_get_sched_stathz(), kinfo_get_tty_tk_nin(), kinfo_get_tty_tk_nout(), and kinfo_get_vfs_bufspace() functions can fail with the errors documented in sysctlbyname(3).

The kinfo_get_files(), kinfo_get_net_rtstatistics(), and kinfo_get_sched_cputime() functions will fail if:

[]
Insufficient memory was available.

kvm(3)

The kinfo library first appeared in DragonFly 1.2.

Joerg Sonnenberger

January 22, 2015 DragonFly-5.6.1