share/mk/: Fix includes
[man-pages.git] / man2 / sysinfo.2
blob75c5784048180521070338617965a0a765a0d6c0
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
6 .\" source files.
7 .\"
8 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
9 .\"
10 .\"
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>
14 .\"
15 .TH sysinfo 2 (date) "Linux man-pages (unreleased)"
16 .SH NAME
17 sysinfo \- return system information
18 .SH LIBRARY
19 Standard C library
20 .RI ( libc ", " \-lc )
21 .SH SYNOPSIS
22 .nf
23 .B #include <sys/sysinfo.h>
25 .BI "int sysinfo(struct sysinfo *" info );
26 .fi
27 .SH DESCRIPTION
28 .BR sysinfo ()
29 returns certain statistics on memory and swap usage,
30 as well as the load average.
32 Until Linux 2.3.16,
33 .BR sysinfo ()
34 returned information in the following structure:
36 .in +4n
37 .EX
38 struct sysinfo {
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 */
50 .EE
51 .in
53 In the above structure, the sizes of the memory and swap fields
54 are given in bytes.
56 Since Linux 2.3.23 (i386) and Linux 2.3.48
57 (all architectures) the structure is:
59 .in +4n
60 .EX
61 struct sysinfo {
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 */
77 .EE
78 .in
80 In the above structure,
81 sizes of the memory and swap fields are given as multiples of
82 .I mem_unit
83 bytes.
84 .SH RETURN VALUE
85 On success,
86 .BR sysinfo ()
87 returns zero.
88 On error, \-1 is returned, and
89 .I errno
90 is set to indicate the error.
91 .SH ERRORS
92 .TP
93 .B EFAULT
94 .I info
95 is not a valid address.
96 .SH STANDARDS
97 Linux.
98 .SH HISTORY
99 Linux 0.98.pl6.
100 .SH NOTES
101 All of the information provided by this system call is also available via
102 .I /proc/meminfo
104 .IR /proc/loadavg .
105 .SH SEE ALSO
106 .BR proc (5)