3 .\" (C)opyright 1993 by Dan Miner (dminer@nyx.cs.du.edu)
5 .\" Permission is granted to freely distribute or modify this file
6 .\" for the purpose of improving Linux or its documentation efforts.
7 .\" If you modify this file, please put a date stamp and HOW you
8 .\" changed this file. Thanks. -DM
10 .\" Modified Sat Jul 24 12:35:12 1993 by Rik Faith <faith@cs.unc.edu>
11 .\" Modified Tue Oct 22 22:29:51 1996 by Eric S. Raymond <esr@thyrsus.com>
12 .\" Modified Mon Aug 25 16:06:11 1997 by Nicolás Lichtmaier <nick@debian.org>
14 .TH SYSINFO 2 1997-08-25 "Linux 2.0" "Linux Programmer's Manual"
16 sysinfo \- returns information on overall system statistics
18 .B #include <sys/sysinfo.h>
20 .BI "int sysinfo(struct sysinfo *" info );
24 used to return information in the following structure:
29 long uptime; /* Seconds since boot */
30 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
31 unsigned long totalram; /* Total usable main memory size */
32 unsigned long freeram; /* Available memory size */
33 unsigned long sharedram; /* Amount of shared memory */
34 unsigned long bufferram; /* Memory used by buffers */
35 unsigned long totalswap; /* Total swap space size */
36 unsigned long freeswap; /* swap space still available */
37 unsigned short procs; /* Number of current processes */
38 char _f[22]; /* Pads structure to 64 bytes */
43 and the sizes were given in bytes. Since Linux 2.3.23 (i386), 2.3.48
44 (all architectures) the structure is
49 long uptime; /* Seconds since boot */
50 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
51 unsigned long totalram; /* Total usable main memory size */
52 unsigned long freeram; /* Available memory size */
53 unsigned long sharedram; /* Amount of shared memory */
54 unsigned long bufferram; /* Memory used by buffers */
55 unsigned long totalswap; /* Total swap space size */
56 unsigned long freeswap; /* swap space still available */
57 unsigned short procs; /* Number of current processes */
58 unsigned long totalhigh; /* Total high memory size */
59 unsigned long freehigh; /* Available high memory size */
60 unsigned int mem_unit; /* Memory unit size in bytes */
61 char _f[20\-2*sizeof(long)\-sizeof(int)]; /* Padding for libc5 */
66 and the sizes are given as multiples of \fImem_unit\fP bytes.
69 provides a simple way of getting overall system statistics. This is more
70 portable than reading \fI/dev/kmem\fP.
71 For an example of its use, see intro(2).
73 On success, zero is returned. On error, \-1 is returned, and
79 pointer to \fIstruct\ sysinfo\fP is invalid
81 This function is Linux-specific, and should not be used in programs
82 intended to be portable.
84 The Linux kernel has a sysinfo system call since 0.98.pl6.
85 Linux libc contains a sysinfo() routine since 5.3.5, and
86 glibc has one since 1.90.