]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/sysinfo.2
Automated addition of parentheses by add_parens_for_own_funcs.sh
[thirdparty/man-pages.git] / man2 / sysinfo.2
1 .\" -*- nroff -*-
2 .\"
3 .\" (C)opyright 1993 by Dan Miner (dminer@nyx.cs.du.edu)
4 .\"
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
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 1997-08-25 "Linux 2.0" "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 .RS
27 .nf
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 .fi
41 .RE
42
43 and the sizes were given in bytes. Since Linux 2.3.23 (i386), 2.3.48
44 (all architectures) the structure is
45
46 .RS
47 .nf
48 struct sysinfo {
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 */
62 };
63 .fi
64 .RE
65
66 and the sizes are given as multiples of \fImem_unit\fP bytes.
67
68 .BR sysinfo ()
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).
72 .SH "RETURN VALUE"
73 On success, zero is returned. On error, \-1 is returned, and
74 .I errno
75 is set appropriately.
76 .SH ERRORS
77 .TP
78 .B EFAULT
79 pointer to \fIstruct\ sysinfo\fP is invalid
80 .SH "CONFORMING TO"
81 This function is Linux-specific, and should not be used in programs
82 intended to be portable.
83 .sp
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.
87 .SH "SEE ALSO"
88 .BR proc (5)