1 .\" Copyright (C) 2016, Michael Kerrisk <mtk.manpages@gmail.com>
2 .\" Based on an earlier version of the page where a few pieces were
3 .\" copyright (C) 1993 by Dan Miner (dminer@nyx.cs.du.edu) and subsequently
4 .\" others (see old changelog below).
5 .\" The structure definitions are taken more or less straight from the kernel
8 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
11 .\" Modified Sat Jul 24 12:35:12 1993 by Rik Faith <faith@cs.unc.edu>
12 .\" Modified Tue Oct 22 22:29:51 1996 by Eric S. Raymond <esr@thyrsus.com>
13 .\" Modified Mon Aug 25 16:06:11 1997 by Nicolás Lichtmaier <nick@debian.org>
15 .TH SYSINFO 2 2021-03-22 "Linux" "Linux Programmer's Manual"
17 sysinfo \- return system information
20 .B #include <sys/sysinfo.h>
22 .BI "int sysinfo(struct sysinfo *" info );
26 returns certain statistics on memory and swap usage,
27 as well as the load average.
31 returned information in the following structure:
36 long uptime; /* Seconds since boot */
37 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
38 unsigned long totalram; /* Total usable main memory size */
39 unsigned long freeram; /* Available memory size */
40 unsigned long sharedram; /* Amount of shared memory */
41 unsigned long bufferram; /* Memory used by buffers */
42 unsigned long totalswap; /* Total swap space size */
43 unsigned long freeswap; /* Swap space still available */
44 unsigned short procs; /* Number of current processes */
45 char _f[22]; /* Pads structure to 64 bytes */
50 In the above structure, the sizes of the memory and swap fields
53 Since Linux 2.3.23 (i386) and Linux 2.3.48
54 (all architectures) the structure is:
59 long uptime; /* Seconds since boot */
60 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
61 unsigned long totalram; /* Total usable main memory size */
62 unsigned long freeram; /* Available memory size */
63 unsigned long sharedram; /* Amount of shared memory */
64 unsigned long bufferram; /* Memory used by buffers */
65 unsigned long totalswap; /* Total swap space size */
66 unsigned long freeswap; /* Swap space still available */
67 unsigned short procs; /* Number of current processes */
68 unsigned long totalhigh; /* Total high memory size */
69 unsigned long freehigh; /* Available high memory size */
70 unsigned int mem_unit; /* Memory unit size in bytes */
71 char _f[20\-2*sizeof(long)\-sizeof(int)];
72 /* Padding to 64 bytes */
77 In the above structure,
78 sizes of the memory and swap fields are given as multiples of
85 On error, \-1 is returned, and
87 is set to indicate the error.
92 is not a valid address.
95 first appeared in Linux 0.98.pl6.
97 This function is Linux-specific, and should not be used in programs
98 intended to be portable.
100 All of the information provided by this system call is also available via