]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/sysinfo.2
sched_setattr.2: tfix
[thirdparty/man-pages.git] / man2 / sysinfo.2
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 .\" %%%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.
12 .\"
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.
17 .\"
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
24 .\" professionally.
25 .\"
26 .\" Formatted or processed versions of this manual, if unaccompanied by
27 .\" the source, must acknowledge the copyright and authors of this work.
28 .\" %%%LICENSE_END
29 .\"
30 .\"
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>
34 .\"
35 .TH SYSINFO 2 2017-09-15 "Linux" "Linux Programmer's Manual"
36 .SH NAME
37 sysinfo \- return system information
38 .SH SYNOPSIS
39 .B #include <sys/sysinfo.h>
40 .PP
41 .BI "int sysinfo(struct sysinfo *" info );
42 .SH DESCRIPTION
43 .BR sysinfo ()
44 returns certain statistics on memory and swap usage,
45 as well as the load average.
46 .PP
47 Until Linux 2.3.16,
48 .BR sysinfo ()
49 returned information in the following structure:
50 .PP
51 .in +4n
52 .EX
53 struct sysinfo {
54 long uptime; /* Seconds since boot */
55 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
56 unsigned long totalram; /* Total usable main memory size */
57 unsigned long freeram; /* Available memory size */
58 unsigned long sharedram; /* Amount of shared memory */
59 unsigned long bufferram; /* Memory used by buffers */
60 unsigned long totalswap; /* Total swap space size */
61 unsigned long freeswap; /* Swap space still available */
62 unsigned short procs; /* Number of current processes */
63 char _f[22]; /* Pads structure to 64 bytes */
64 };
65 .EE
66 .in
67 .PP
68 In the above structure, the sizes of the memory and swap fields
69 are given in bytes.
70 .PP
71 Since Linux 2.3.23 (i386) and Linux 2.3.48
72 (all architectures) the structure is:
73 .PP
74 .in +4n
75 .EX
76 struct sysinfo {
77 long uptime; /* Seconds since boot */
78 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
79 unsigned long totalram; /* Total usable main memory size */
80 unsigned long freeram; /* Available memory size */
81 unsigned long sharedram; /* Amount of shared memory */
82 unsigned long bufferram; /* Memory used by buffers */
83 unsigned long totalswap; /* Total swap space size */
84 unsigned long freeswap; /* Swap space still available */
85 unsigned short procs; /* Number of current processes */
86 unsigned long totalhigh; /* Total high memory size */
87 unsigned long freehigh; /* Available high memory size */
88 unsigned int mem_unit; /* Memory unit size in bytes */
89 char _f[20\-2*sizeof(long)\-sizeof(int)];
90 /* Padding to 64 bytes */
91 };
92 .EE
93 .in
94 .PP
95 In the above structure,
96 sizes of the memory and swap fields are given as multiples of
97 .I mem_unit
98 bytes.
99 .SH RETURN VALUE
100 On success,
101 .BR sysinfo ()
102 returns zero.
103 On error, \-1 is returned, and
104 .I errno
105 is set to indicate the cause of the error.
106 .SH ERRORS
107 .TP
108 .B EFAULT
109 .IR info
110 is not a valid address.
111 .SH VERSIONS
112 .BR sysinfo ()
113 first appeared in Linux 0.98.pl6.
114 .SH CONFORMING TO
115 This function is Linux-specific, and should not be used in programs
116 intended to be portable.
117 .SH NOTES
118 All of the information provided by this system call is also available via
119 .IR /proc/meminfo
120 and
121 .IR /proc/loadavg .
122 .SH SEE ALSO
123 .BR proc (5)