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 .\" %%%LICENSE_START(VERBATIM)
9 .\" Permission is granted to make and distribute verbatim copies of this
10 .\" manual provided the copyright notice and this permission notice are
11 .\" preserved on all copies.
13 .\" Permission is granted to copy and distribute modified versions of this
14 .\" manual under the conditions for verbatim copying, provided that the
15 .\" entire resulting derived work is distributed under the terms of a
16 .\" permission notice identical to this one.
18 .\" Since the Linux kernel and libraries are constantly changing, this
19 .\" manual page may be incorrect or out-of-date. The author(s) assume no
20 .\" responsibility for errors or omissions, or for damages resulting from
21 .\" the use of the information contained herein. The author(s) may not
22 .\" have taken the same level of care in the production of this manual,
23 .\" which is licensed free of charge, as they might when working
26 .\" Formatted or processed versions of this manual, if unaccompanied by
27 .\" the source, must acknowledge the copyright and authors of this work.
31 .\" Modified Sat Jul 24 12:35:12 1993 by Rik Faith <faith@cs.unc.edu>
32 .\" Modified Tue Oct 22 22:29:51 1996 by Eric S. Raymond <esr@thyrsus.com>
33 .\" Modified Mon Aug 25 16:06:11 1997 by Nicolás Lichtmaier <nick@debian.org>
35 .TH SYSINFO 2 2021-03-22 "Linux" "Linux Programmer's Manual"
37 sysinfo \- return system information
40 .B #include <sys/sysinfo.h>
42 .BI "int sysinfo(struct sysinfo *" info );
46 returns certain statistics on memory and swap usage,
47 as well as the load average.
51 returned information in the following structure:
56 long uptime; /* Seconds since boot */
57 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
58 unsigned long totalram; /* Total usable main memory size */
59 unsigned long freeram; /* Available memory size */
60 unsigned long sharedram; /* Amount of shared memory */
61 unsigned long bufferram; /* Memory used by buffers */
62 unsigned long totalswap; /* Total swap space size */
63 unsigned long freeswap; /* Swap space still available */
64 unsigned short procs; /* Number of current processes */
65 char _f[22]; /* Pads structure to 64 bytes */
70 In the above structure, the sizes of the memory and swap fields
73 Since Linux 2.3.23 (i386) and Linux 2.3.48
74 (all architectures) the structure is:
79 long uptime; /* Seconds since boot */
80 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
81 unsigned long totalram; /* Total usable main memory size */
82 unsigned long freeram; /* Available memory size */
83 unsigned long sharedram; /* Amount of shared memory */
84 unsigned long bufferram; /* Memory used by buffers */
85 unsigned long totalswap; /* Total swap space size */
86 unsigned long freeswap; /* Swap space still available */
87 unsigned short procs; /* Number of current processes */
88 unsigned long totalhigh; /* Total high memory size */
89 unsigned long freehigh; /* Available high memory size */
90 unsigned int mem_unit; /* Memory unit size in bytes */
91 char _f[20\-2*sizeof(long)\-sizeof(int)];
92 /* Padding to 64 bytes */
97 In the above structure,
98 sizes of the memory and swap fields are given as multiples of
105 On error, \-1 is returned, and
107 is set to indicate the error.
112 is not a valid address.
115 first appeared in Linux 0.98.pl6.
117 This function is Linux-specific, and should not be used in programs
118 intended to be portable.
120 All of the information provided by this system call is also available via