OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man2 / sysinfo.2
1 .\" Copyright (C) 1993 by Dan Miner (dminer@nyx.cs.du.edu)
2 .\"
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
8 .\" %%%LICENSE_END
9 .\"
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>
13 .\"
14 .TH SYSINFO 2 2014-08-19 "Linux" "Linux Programmer's Manual"
15 .SH NAME
16 sysinfo \- returns information on overall system statistics
17 .SH SYNOPSIS
18 .B #include <sys/sysinfo.h>
19 .sp
20 .BI "int sysinfo(struct sysinfo *" info );
21 .SH DESCRIPTION
22 Until Linux 2.3.16,
23 .BR sysinfo ()
24 used to return information in the following structure:
25
26 .nf
27 .in +4n
28 struct sysinfo {
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 */
39 };
40 .in
41 .fi
42 .PP
43 and the sizes were given in bytes.
44
45 Since Linux 2.3.23 (i386), 2.3.48
46 (all architectures) the structure is:
47
48 .nf
49 .in +4n
50 struct sysinfo {
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 */
64 };
65 .in
66 .fi
67 .PP
68 and the sizes are given as multiples of \fImem_unit\fP bytes.
69
70 .BR sysinfo ()
71 provides a simple way of getting overall system statistics.
72 This is more
73 portable than reading \fI/dev/kmem\fP.
74 .SH RETURN VALUE
75 On success, zero is returned.
76 On error, \-1 is returned, and
77 .I errno
78 is set appropriately.
79 .SH ERRORS
80 .TP
81 .B EFAULT
82 pointer to \fIstruct\ sysinfo\fP is invalid
83 .SH VERSIONS
84 The Linux kernel has a
85 .BR sysinfo ()
86 system call since 0.98.pl6.
87 .SH CONFORMING TO
88 This function is Linux-specific, and should not be used in programs
89 intended to be portable.
90 .SH SEE ALSO
91 .BR proc (5)
92 .SH COLOPHON
93 This page is part of release 3.79 of the Linux
94 .I man-pages
95 project.
96 A description of the project,
97 information about reporting bugs,
98 and the latest version of this page,
99 can be found at
100 \%http://www.kernel.org/doc/man\-pages/.