]>
Commit | Line | Data |
---|---|---|
641277ec MK |
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. | |
fea681da | 7 | .\" |
a8fa0597 MK |
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. | |
8ff7380d | 28 | .\" %%%LICENSE_END |
fea681da | 29 | .\" |
a8fa0597 | 30 | .\" |
fea681da MK |
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> | |
e00c3a07 | 33 | .\" Modified Mon Aug 25 16:06:11 1997 by Nicolás Lichtmaier <nick@debian.org> |
fea681da | 34 | .\" |
4b8c67d9 | 35 | .TH SYSINFO 2 2017-09-15 "Linux" "Linux Programmer's Manual" |
fea681da | 36 | .SH NAME |
641277ec | 37 | sysinfo \- return system information |
fea681da MK |
38 | .SH SYNOPSIS |
39 | .B #include <sys/sysinfo.h> | |
68e4db0a | 40 | .PP |
fea681da MK |
41 | .BI "int sysinfo(struct sysinfo *" info ); |
42 | .SH DESCRIPTION | |
641277ec MK |
43 | .BR sysinfo () |
44 | returns certain statistics on memory and swap usage, | |
45 | as well as the load average. | |
efeece04 | 46 | .PP |
fea681da | 47 | Until Linux 2.3.16, |
e511ffb6 | 48 | .BR sysinfo () |
641277ec | 49 | returned information in the following structure: |
efeece04 | 50 | .PP |
a08ea57c | 51 | .in +4n |
b8302363 | 52 | .EX |
fea681da | 53 | struct sysinfo { |
521bf584 MK |
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 */ | |
641277ec | 61 | unsigned long freeswap; /* Swap space still available */ |
521bf584 MK |
62 | unsigned short procs; /* Number of current processes */ |
63 | char _f[22]; /* Pads structure to 64 bytes */ | |
fea681da | 64 | }; |
b8302363 | 65 | .EE |
e646a1ba | 66 | .in |
521bf584 | 67 | .PP |
641277ec MK |
68 | In the above structure, the sizes of the memory and swap fields |
69 | are given in bytes. | |
efeece04 | 70 | .PP |
641277ec | 71 | Since Linux 2.3.23 (i386) and Linux 2.3.48 |
521bf584 | 72 | (all architectures) the structure is: |
efeece04 | 73 | .PP |
a08ea57c | 74 | .in +4n |
b8302363 | 75 | .EX |
fea681da | 76 | struct sysinfo { |
521bf584 MK |
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 */ | |
641277ec | 84 | unsigned long freeswap; /* Swap space still available */ |
521bf584 MK |
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 */ | |
641277ec MK |
89 | char _f[20\-2*sizeof(long)\-sizeof(int)]; |
90 | /* Padding to 64 bytes */ | |
fea681da | 91 | }; |
b8302363 | 92 | .EE |
e646a1ba | 93 | .in |
521bf584 | 94 | .PP |
641277ec MK |
95 | In the above structure, |
96 | sizes of the memory and swap fields are given as multiples of | |
97 | .I mem_unit | |
98 | bytes. | |
47297adb | 99 | .SH RETURN VALUE |
641277ec MK |
100 | On success, |
101 | .BR sysinfo () | |
102 | returns zero. | |
c13182ef | 103 | On error, \-1 is returned, and |
fea681da | 104 | .I errno |
641277ec | 105 | is set to indicate the cause of the error. |
fea681da MK |
106 | .SH ERRORS |
107 | .TP | |
108 | .B EFAULT | |
641277ec MK |
109 | .IR info |
110 | is not a valid address. | |
531bbb0f | 111 | .SH VERSIONS |
c13182ef | 112 | .BR sysinfo () |
641277ec | 113 | first appeared in Linux 0.98.pl6. |
531bbb0f MK |
114 | .SH CONFORMING TO |
115 | This function is Linux-specific, and should not be used in programs | |
116 | intended to be portable. | |
641277ec MK |
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 . | |
47297adb | 122 | .SH SEE ALSO |
fea681da | 123 | .BR proc (5) |