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 (date) "Linux man-pages (unreleased)"
17 sysinfo \- return system information
20 .RI ( libc ", " \-lc )
23 .B #include <sys/sysinfo.h>
25 .BI "int sysinfo(struct sysinfo *" info );
29 returns certain statistics on memory and swap usage,
30 as well as the load average.
34 returned information in the following structure:
39 long uptime; /* Seconds since boot */
40 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
41 unsigned long totalram; /* Total usable main memory size */
42 unsigned long freeram; /* Available memory size */
43 unsigned long sharedram; /* Amount of shared memory */
44 unsigned long bufferram; /* Memory used by buffers */
45 unsigned long totalswap; /* Total swap space size */
46 unsigned long freeswap; /* Swap space still available */
47 unsigned short procs; /* Number of current processes */
48 char _f[22]; /* Pads structure to 64 bytes */
53 In the above structure, the sizes of the memory and swap fields
56 Since Linux 2.3.23 (i386) and Linux 2.3.48
57 (all architectures) the structure is:
62 long uptime; /* Seconds since boot */
63 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
64 unsigned long totalram; /* Total usable main memory size */
65 unsigned long freeram; /* Available memory size */
66 unsigned long sharedram; /* Amount of shared memory */
67 unsigned long bufferram; /* Memory used by buffers */
68 unsigned long totalswap; /* Total swap space size */
69 unsigned long freeswap; /* Swap space still available */
70 unsigned short procs; /* Number of current processes */
71 unsigned long totalhigh; /* Total high memory size */
72 unsigned long freehigh; /* Available high memory size */
73 unsigned int mem_unit; /* Memory unit size in bytes */
74 char _f[20\-2*sizeof(long)\-sizeof(int)];
75 /* Padding to 64 bytes */
80 In the above structure,
81 sizes of the memory and swap fields are given as multiples of
88 On error, \-1 is returned, and
90 is set to indicate the error.
95 is not a valid address.
98 first appeared in Linux 0.98.pl6.
100 This function is Linux-specific, and should not be used in programs
101 intended to be portable.
103 All of the information provided by this system call is also available via