]>
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 | .\" |
5fbde956 | 8 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da | 9 | .\" |
a8fa0597 | 10 | .\" |
fea681da MK |
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> | |
e00c3a07 | 13 | .\" Modified Mon Aug 25 16:06:11 1997 by Nicolás Lichtmaier <nick@debian.org> |
fea681da | 14 | .\" |
4c1c5274 | 15 | .TH sysinfo 2 (date) "Linux man-pages (unreleased)" |
fea681da | 16 | .SH NAME |
641277ec | 17 | sysinfo \- return system information |
2555d98c AC |
18 | .SH LIBRARY |
19 | Standard C library | |
8fc3b2cf | 20 | .RI ( libc ", " \-lc ) |
fea681da | 21 | .SH SYNOPSIS |
c7db92b9 | 22 | .nf |
fea681da | 23 | .B #include <sys/sysinfo.h> |
68e4db0a | 24 | .PP |
fea681da | 25 | .BI "int sysinfo(struct sysinfo *" info ); |
c7db92b9 | 26 | .fi |
fea681da | 27 | .SH DESCRIPTION |
641277ec MK |
28 | .BR sysinfo () |
29 | returns certain statistics on memory and swap usage, | |
30 | as well as the load average. | |
efeece04 | 31 | .PP |
fea681da | 32 | Until Linux 2.3.16, |
e511ffb6 | 33 | .BR sysinfo () |
641277ec | 34 | returned information in the following structure: |
efeece04 | 35 | .PP |
a08ea57c | 36 | .in +4n |
b8302363 | 37 | .EX |
fea681da | 38 | struct sysinfo { |
521bf584 MK |
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 */ | |
641277ec | 46 | unsigned long freeswap; /* Swap space still available */ |
521bf584 MK |
47 | unsigned short procs; /* Number of current processes */ |
48 | char _f[22]; /* Pads structure to 64 bytes */ | |
fea681da | 49 | }; |
b8302363 | 50 | .EE |
e646a1ba | 51 | .in |
521bf584 | 52 | .PP |
641277ec MK |
53 | In the above structure, the sizes of the memory and swap fields |
54 | are given in bytes. | |
efeece04 | 55 | .PP |
641277ec | 56 | Since Linux 2.3.23 (i386) and Linux 2.3.48 |
521bf584 | 57 | (all architectures) the structure is: |
efeece04 | 58 | .PP |
a08ea57c | 59 | .in +4n |
b8302363 | 60 | .EX |
fea681da | 61 | struct sysinfo { |
521bf584 MK |
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 */ | |
641277ec | 69 | unsigned long freeswap; /* Swap space still available */ |
521bf584 MK |
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 */ | |
641277ec MK |
74 | char _f[20\-2*sizeof(long)\-sizeof(int)]; |
75 | /* Padding to 64 bytes */ | |
fea681da | 76 | }; |
b8302363 | 77 | .EE |
e646a1ba | 78 | .in |
521bf584 | 79 | .PP |
641277ec MK |
80 | In the above structure, |
81 | sizes of the memory and swap fields are given as multiples of | |
82 | .I mem_unit | |
83 | bytes. | |
47297adb | 84 | .SH RETURN VALUE |
641277ec MK |
85 | On success, |
86 | .BR sysinfo () | |
87 | returns zero. | |
c13182ef | 88 | On error, \-1 is returned, and |
fea681da | 89 | .I errno |
855d489a | 90 | is set to indicate the error. |
fea681da MK |
91 | .SH ERRORS |
92 | .TP | |
93 | .B EFAULT | |
1ae6b2c7 | 94 | .I info |
641277ec | 95 | is not a valid address. |
531bbb0f | 96 | .SH VERSIONS |
c13182ef | 97 | .BR sysinfo () |
641277ec | 98 | first appeared in Linux 0.98.pl6. |
3113c7f3 | 99 | .SH STANDARDS |
531bbb0f MK |
100 | This function is Linux-specific, and should not be used in programs |
101 | intended to be portable. | |
641277ec MK |
102 | .SH NOTES |
103 | All of the information provided by this system call is also available via | |
1ae6b2c7 | 104 | .I /proc/meminfo |
641277ec MK |
105 | and |
106 | .IR /proc/loadavg . | |
47297adb | 107 | .SH SEE ALSO |
fea681da | 108 | .BR proc (5) |