DragonFly On-Line Manual Pages

Search: Section:  


KINFO(3)              DragonFly Library Functions Manual              KINFO(3)

NAME

cputime_pcpu_statistics, 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_bufspace, route_pcpu_statistics - information about the running kernel

LIBRARY

Kernel Information Access Library (libkinfo, -lkinfo)

SYNOPSIS

#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); void cputime_pcpu_statistics(struct kinfo_cputime *percpu, struct kinfo_cputime *total, int ncpu); void route_pcpu_statistics(struct rtstatistics *percpu, struct rtstatistics *total, int ncpu);

DESCRIPTION

File Information The kinfo_get_files() 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 free() the array. The kinfo_get_maxfiles() and kinfo_get_openfiles() functions return the maximum number of files and the number of open files in the maxfiles and openfiles arguments, respectively. Networking Information The kinfo_get_net_rtstatistics() 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. Scheduling/Time Information The kinfo_get_cpus() function returns the number of active CPUs in the ncpus argument. The kinfo_get_sched_cputime() 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 kinfo_get_sched_hz(), kinfo_get_sched_profhz(), and kinfo_get_sched_stathz() 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. TTY Information The kinfo_get_tty_tk_nin() and kinfo_get_tty_tk_nout() 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. VFS Information The kinfo_get_vfs_bufspace() function returns the maximum amount of memory available for VFS buffers in the bufspace argument. Per CPU Accumulators The cputime_pcpu_statistics() and route_pcpu_statistics() functions provide per-CPU routing and CPU time statistics. Each take two pointers, one for the per-CPU statistics and another for the total.

RETURN VALUES

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.

ERRORS

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: [ENOMEM] Insufficient memory was available.

SEE ALSO

kvm(3)

HISTORY

The kinfo library first appeared in DragonFly 1.2.

AUTHORS

Joerg Sonnenberger DragonFly 5.9-DEVELOPMENT February 5, 2021 DragonFly 5.9-DEVELOPMENT

Search: Section: