172 lines
6.2 KiB
HTML
172 lines
6.2 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SYSINFO</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SYSINFO</H1>
|
|
Section: Linux Programmer's Manual (2)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
sysinfo - return system information
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/sys/sysinfo.h">sys/sysinfo.h</A>></B>
|
|
|
|
<P>
|
|
|
|
<B>int sysinfo(struct sysinfo *</B><I>info</I><B>);</B>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>sysinfo</B>()
|
|
|
|
returns certain statistics on memory and swap usage,
|
|
as well as the load average.
|
|
<P>
|
|
|
|
Until Linux 2.3.16,
|
|
<B>sysinfo</B>()
|
|
|
|
returned information in the following structure:
|
|
<P>
|
|
|
|
|
|
|
|
struct sysinfo {
|
|
<BR> long uptime; /* Seconds since boot */
|
|
<BR> unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
|
|
<BR> unsigned long totalram; /* Total usable main memory size */
|
|
<BR> unsigned long freeram; /* Available memory size */
|
|
<BR> unsigned long sharedram; /* Amount of shared memory */
|
|
<BR> unsigned long bufferram; /* Memory used by buffers */
|
|
<BR> unsigned long totalswap; /* Total swap space size */
|
|
<BR> unsigned long freeswap; /* Swap space still available */
|
|
<BR> unsigned short procs; /* Number of current processes */
|
|
<BR> char _f[22]; /* Pads structure to 64 bytes */
|
|
};
|
|
|
|
|
|
<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>
|
|
|
|
|
|
|
|
struct sysinfo {
|
|
<BR> long uptime; /* Seconds since boot */
|
|
<BR> unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
|
|
<BR> unsigned long totalram; /* Total usable main memory size */
|
|
<BR> unsigned long freeram; /* Available memory size */
|
|
<BR> unsigned long sharedram; /* Amount of shared memory */
|
|
<BR> unsigned long bufferram; /* Memory used by buffers */
|
|
<BR> unsigned long totalswap; /* Total swap space size */
|
|
<BR> unsigned long freeswap; /* Swap space still available */
|
|
<BR> unsigned short procs; /* Number of current processes */
|
|
<BR> unsigned long totalhigh; /* Total high memory size */
|
|
<BR> unsigned long freehigh; /* Available high memory size */
|
|
<BR> unsigned int mem_unit; /* Memory unit size in bytes */
|
|
<BR> char _f[20-2*sizeof(long)-sizeof(int)];
|
|
<BR> /* Padding to 64 bytes */
|
|
};
|
|
|
|
|
|
<P>
|
|
|
|
In the above structure,
|
|
sizes of the memory and swap fields are given as multiples of
|
|
<I>mem_unit</I>
|
|
|
|
bytes.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success,
|
|
<B>sysinfo</B>()
|
|
|
|
returns zero.
|
|
On error, -1 is returned, and
|
|
<I>errno</I>
|
|
|
|
is set to indicate the cause of the error.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>EFAULT</B>
|
|
|
|
<DD>
|
|
<I>info</I>
|
|
|
|
is not a valid address.
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
<B>sysinfo</B>()
|
|
|
|
first appeared in Linux 0.98.pl6.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
This function is Linux-specific, and should not be used in programs
|
|
intended to be portable.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
All of the information provided by this system call is also available via
|
|
<I>/proc/meminfo</I>
|
|
|
|
and
|
|
<I>/proc/loadavg</I>.
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+proc">proc</A></B>(5)
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="2"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="3"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="4"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="5"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="6"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="7"><A HREF="#lbAG">VERSIONS</A><DD>
|
|
<DT id="8"><A HREF="#lbAH">CONFORMING TO</A><DD>
|
|
<DT id="9"><A HREF="#lbAI">NOTES</A><DD>
|
|
<DT id="10"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="11"><A HREF="#lbAK">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:35 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|