1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
.\" Copyright, the authors of the Linux man-pages project
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
.TH sysinfo 2 2025-05-17 "Linux man-pages (unreleased)"
.SH NAME
sysinfo \- return system information
.SH LIBRARY
Standard C library
.RI ( libc ,\~ \-lc )
.SH SYNOPSIS
.nf
.B #include <sys/sysinfo.h>
.P
.BI "int sysinfo(struct sysinfo *" info );
.fi
.SH DESCRIPTION
.BR sysinfo ()
returns certain statistics on memory and swap usage,
as well as the load average.
.P
Until Linux 2.3.16,
.BR sysinfo ()
returned information in the following structure:
.P
.in +4n
.EX
struct sysinfo {
long uptime; /* Seconds since boot */
unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
unsigned long totalram; /* Total usable main memory size */
unsigned long freeram; /* Available memory size */
unsigned long sharedram; /* Amount of shared memory */
unsigned long bufferram; /* Memory used by buffers */
unsigned long totalswap; /* Total swap space size */
unsigned long freeswap; /* Swap space still available */
unsigned short procs; /* Number of current processes */
char _f[22]; /* Pads structure to 64 bytes */
};
.EE
.in
.P
In the above structure, the sizes of the memory and swap fields
are given in bytes.
.P
Since Linux 2.3.23 (i386) and Linux 2.3.48
(all architectures) the structure is:
.P
.in +4n
.EX
struct sysinfo {
long uptime; /* Seconds since boot */
unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
unsigned long totalram; /* Total usable main memory size */
unsigned long freeram; /* Available memory size */
unsigned long sharedram; /* Amount of shared memory */
unsigned long bufferram; /* Memory used by buffers */
unsigned long totalswap; /* Total swap space size */
unsigned long freeswap; /* Swap space still available */
unsigned short procs; /* Number of current processes */
unsigned long totalhigh; /* Total high memory size */
unsigned long freehigh; /* Available high memory size */
unsigned int mem_unit; /* Memory unit size in bytes */
char _f[20\-2*sizeof(long)\-sizeof(int)];
/* Padding to 64 bytes */
};
.EE
.in
.P
In the above structure,
sizes of the memory and swap fields are given as multiples of
.I mem_unit
bytes.
.SH RETURN VALUE
On success,
.BR sysinfo ()
returns zero.
On error, \-1 is returned, and
.I errno
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT
.I info
is not a valid address.
.SH STANDARDS
Linux.
.SH HISTORY
Linux 0.98.pl6.
.SH NOTES
All of the information provided by this system call is also available via
.I /proc/meminfo
and
.IR /proc/loadavg .
.SH SEE ALSO
.BR proc (5)
|