1SYSINFO(2)                 Linux Programmer's Manual                SYSINFO(2)
2
3
4

NAME

6       sysinfo - return system information
7

SYNOPSIS

9       #include <sys/sysinfo.h>
10
11       int sysinfo(struct sysinfo *info);
12

DESCRIPTION

14       sysinfo()  returns certain statistics on memory and swap usage, as well
15       as the load average.
16
17       Until Linux 2.3.16, sysinfo() returned  information  in  the  following
18       structure:
19
20           struct sysinfo {
21               long uptime;             /* Seconds since boot */
22               unsigned long loads[3];  /* 1, 5, and 15 minute load averages */
23               unsigned long totalram;  /* Total usable main memory size */
24               unsigned long freeram;   /* Available memory size */
25               unsigned long sharedram; /* Amount of shared memory */
26               unsigned long bufferram; /* Memory used by buffers */
27               unsigned long totalswap; /* Total swap space size */
28               unsigned long freeswap;  /* Swap space still available */
29               unsigned short procs;    /* Number of current processes */
30               char _f[22];             /* Pads structure to 64 bytes */
31           };
32
33       In  the  above  structure,  the sizes of the memory and swap fields are
34       given in bytes.
35
36       Since Linux 2.3.23 (i386) and  Linux  2.3.48  (all  architectures)  the
37       structure is:
38
39           struct sysinfo {
40               long uptime;             /* Seconds since boot */
41               unsigned long loads[3];  /* 1, 5, and 15 minute load averages */
42               unsigned long totalram;  /* Total usable main memory size */
43               unsigned long freeram;   /* Available memory size */
44               unsigned long sharedram; /* Amount of shared memory */
45               unsigned long bufferram; /* Memory used by buffers */
46               unsigned long totalswap; /* Total swap space size */
47               unsigned long freeswap;  /* Swap space still available */
48               unsigned short procs;    /* Number of current processes */
49               unsigned long totalhigh; /* Total high memory size */
50               unsigned long freehigh;  /* Available high memory size */
51               unsigned int mem_unit;   /* Memory unit size in bytes */
52               char _f[20-2*sizeof(long)-sizeof(int)];
53                                        /* Padding to 64 bytes */
54           };
55
56       In  the  above structure, sizes of the memory and swap fields are given
57       as multiples of mem_unit bytes.
58

RETURN VALUE

60       On success, sysinfo() returns zero.  On error, -1 is returned, and  er‐
61       rno is set to indicate the error.
62

ERRORS

64       EFAULT info is not a valid address.
65

VERSIONS

67       sysinfo() first appeared in Linux 0.98.pl6.
68

CONFORMING TO

70       This function is Linux-specific, and should not be used in programs in‐
71       tended to be portable.
72

NOTES

74       All of the information provided by this system call is  also  available
75       via /proc/meminfo and /proc/loadavg.
76

SEE ALSO

78       proc(5)
79

COLOPHON

81       This  page  is  part of release 5.13 of the Linux man-pages project.  A
82       description of the project, information about reporting bugs,  and  the
83       latest     version     of     this    page,    can    be    found    at
84       https://www.kernel.org/doc/man-pages/.
85
86
87
88Linux                             2021-03-22                        SYSINFO(2)
Impressum