1 .\" Copyright (C) 1993 by Dan Miner (dminer@nyx.cs.du.edu)
3 .\" %%%LICENSE_START(FREELY_REDISTRIBUTABLE)
4 .\" Permission is granted to freely distribute or modify this file
5 .\" for the purpose of improving Linux or its documentation efforts.
6 .\" If you modify this file, please put a date stamp and HOW you
7 .\" 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 2014-08-19 "Linux" "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.
45 Since Linux 2.3.23 (i386), 2.3.48
46 (all architectures) the structure is:
51 long uptime; /* Seconds since boot */
52 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
53 unsigned long totalram; /* Total usable main memory size */
54 unsigned long freeram; /* Available memory size */
55 unsigned long sharedram; /* Amount of shared memory */
56 unsigned long bufferram; /* Memory used by buffers */
57 unsigned long totalswap; /* Total swap space size */
58 unsigned long freeswap; /* swap space still available */
59 unsigned short procs; /* Number of current processes */
60 unsigned long totalhigh; /* Total high memory size */
61 unsigned long freehigh; /* Available high memory size */
62 unsigned int mem_unit; /* Memory unit size in bytes */
63 char _f[20\-2*sizeof(long)\-sizeof(int)]; /* Padding to 64 bytes */
68 and the sizes are given as multiples of \fImem_unit\fP bytes.
71 provides a simple way of getting overall system statistics.
73 portable than reading \fI/dev/kmem\fP.
75 On success, zero is returned.
76 On error, \-1 is returned, and
82 pointer to \fIstruct\ sysinfo\fP is invalid
84 The Linux kernel has a
86 system call since 0.98.pl6.
88 This function is Linux-specific, and should not be used in programs
89 intended to be portable.