diff options
Diffstat (limited to 'man2/sysinfo.2')
-rw-r--r-- | man2/sysinfo.2 | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/man2/sysinfo.2 b/man2/sysinfo.2 new file mode 100644 index 0000000..fc44136 --- /dev/null +++ b/man2/sysinfo.2 @@ -0,0 +1,106 @@ +.\" Copyright (C) 2016, Michael Kerrisk <mtk.manpages@gmail.com> +.\" Based on an earlier version of the page where a few pieces were +.\" copyright (C) 1993 by Dan Miner (dminer@nyx.cs.du.edu) and subsequently +.\" others (see old changelog below). +.\" The structure definitions are taken more or less straight from the kernel +.\" source files. +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.\" +.\" Modified Sat Jul 24 12:35:12 1993 by Rik Faith <faith@cs.unc.edu> +.\" Modified Tue Oct 22 22:29:51 1996 by Eric S. Raymond <esr@thyrsus.com> +.\" Modified Mon Aug 25 16:06:11 1997 by Nicolás Lichtmaier <nick@debian.org> +.\" +.TH sysinfo 2 2023-03-30 "Linux man-pages 6.05.01" +.SH NAME +sysinfo \- return system information +.SH LIBRARY +Standard C library +.RI ( libc ", " \-lc ) +.SH SYNOPSIS +.nf +.B #include <sys/sysinfo.h> +.PP +.BI "int sysinfo(struct sysinfo *" info ); +.fi +.SH DESCRIPTION +.BR sysinfo () +returns certain statistics on memory and swap usage, +as well as the load average. +.PP +Until Linux 2.3.16, +.BR sysinfo () +returned information in the following structure: +.PP +.in +4n +.EX +struct sysinfo { + long uptime; /* Seconds since boot */ + unsigned long loads[3]; /* 1, 5, and 15 minute load averages */ + unsigned long totalram; /* Total usable main memory size */ + unsigned long freeram; /* Available memory size */ + unsigned long sharedram; /* Amount of shared memory */ + unsigned long bufferram; /* Memory used by buffers */ + unsigned long totalswap; /* Total swap space size */ + unsigned long freeswap; /* Swap space still available */ + unsigned short procs; /* Number of current processes */ + char _f[22]; /* Pads structure to 64 bytes */ +}; +.EE +.in +.PP +In the above structure, the sizes of the memory and swap fields +are given in bytes. +.PP +Since Linux 2.3.23 (i386) and Linux 2.3.48 +(all architectures) the structure is: +.PP +.in +4n +.EX +struct sysinfo { + long uptime; /* Seconds since boot */ + unsigned long loads[3]; /* 1, 5, and 15 minute load averages */ + unsigned long totalram; /* Total usable main memory size */ + unsigned long freeram; /* Available memory size */ + unsigned long sharedram; /* Amount of shared memory */ + unsigned long bufferram; /* Memory used by buffers */ + unsigned long totalswap; /* Total swap space size */ + unsigned long freeswap; /* Swap space still available */ + unsigned short procs; /* Number of current processes */ + unsigned long totalhigh; /* Total high memory size */ + unsigned long freehigh; /* Available high memory size */ + unsigned int mem_unit; /* Memory unit size in bytes */ + char _f[20\-2*sizeof(long)\-sizeof(int)]; + /* Padding to 64 bytes */ +}; +.EE +.in +.PP +In the above structure, +sizes of the memory and swap fields are given as multiples of +.I mem_unit +bytes. +.SH RETURN VALUE +On success, +.BR sysinfo () +returns zero. +On error, \-1 is returned, and +.I errno +is set to indicate the error. +.SH ERRORS +.TP +.B EFAULT +.I info +is not a valid address. +.SH STANDARDS +Linux. +.SH HISTORY +Linux 0.98.pl6. +.SH NOTES +All of the information provided by this system call is also available via +.I /proc/meminfo +and +.IR /proc/loadavg . +.SH SEE ALSO +.BR proc (5) |