version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
SYSINFO |
|
|
2 |
!!!SYSINFO |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
ERRORS |
|
|
8 |
CONFORMING TO |
|
|
9 |
SEE ALSO |
|
|
10 |
---- |
|
|
11 |
!!NAME |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
sysinfo - returns information on overall system statistics |
|
|
15 |
!!SYNOPSIS |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
__#include __ |
|
|
19 |
|
|
|
20 |
|
|
|
21 |
__int sysinfo(struct sysinfo |
|
|
22 |
*__''info''__);__ |
|
|
23 |
!!DESCRIPTION |
|
|
24 |
|
|
|
25 |
|
|
|
26 |
Until Linux 2.3.16, __sysinfo__ used to return |
|
|
27 |
information in the following structure: |
|
|
28 |
|
|
|
29 |
|
|
|
30 |
struct sysinfo { |
|
|
31 |
long uptime; /* Seconds since boot */ |
|
|
32 |
unsigned long loads[[3]; /* 1, 5, and 15 minute load averages */ |
|
|
33 |
unsigned long totalram; /* Total usable main memory size */ |
|
|
34 |
unsigned long freeram; /* Available memory size */ |
|
|
35 |
unsigned long sharedram; /* Amount of shared memory */ |
|
|
36 |
unsigned long bufferram; /* Memory used by buffers */ |
|
|
37 |
unsigned long totalswap; /* Total swap space size */ |
|
|
38 |
unsigned long freeswap; /* swap space still available */ |
|
|
39 |
unsigned short procs; /* Number of current processes */ |
|
|
40 |
char _f[[22]; /* Pads structure to 64 bytes */ |
|
|
41 |
}; |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
and the sizes were given in bytes. Since Linux 2.3.23 |
|
|
45 |
(i386), 2.3.48 (all architectures) the structure |
|
|
46 |
is |
|
|
47 |
|
|
|
48 |
|
|
|
49 |
struct sysinfo { |
|
|
50 |
long uptime; /* Seconds since boot */ |
|
|
51 |
unsigned long loads[[3]; /* 1, 5, and 15 minute load averages */ |
|
|
52 |
unsigned long totalram; /* Total usable main memory size */ |
|
|
53 |
unsigned long freeram; /* Available memory size */ |
|
|
54 |
unsigned long sharedram; /* Amount of shared memory */ |
|
|
55 |
unsigned long bufferram; /* Memory used by buffers */ |
|
|
56 |
unsigned long totalswap; /* Total swap space size */ |
|
|
57 |
unsigned long freeswap; /* swap space still available */ |
|
|
58 |
unsigned short procs; /* Number of current processes */ |
|
|
59 |
unsigned long totalhigh; /* Total high memory size */ |
|
|
60 |
unsigned long freehigh; /* Available high memory size */ |
|
|
61 |
unsigned int mem_unit; /* Memory unit size in bytes */ |
|
|
62 |
char _f[[20-2*sizeof(long)-sizeof(int)]; /* Padding for libc5 */ |
|
|
63 |
}; |
|
|
64 |
|
|
|
65 |
|
|
|
66 |
and the sizes are given as multiples of ''mem_unit'' |
|
|
67 |
bytes. |
|
|
68 |
|
|
|
69 |
|
|
|
70 |
__sysinfo__ provides a simple way of getting overall |
|
|
71 |
system statistics. This is more portable than reading |
|
|
72 |
''/dev/kmem''. For an example of its use, see |
|
|
73 |
intro(2). |
|
|
74 |
!!RETURN VALUE |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
On success, zero is returned. On error, -1 is returned, and |
|
|
78 |
''errno'' is set appropriately. |
|
|
79 |
!!ERRORS |
|
|
80 |
|
|
|
81 |
|
|
|
82 |
__EFAULT__ |
|
|
83 |
|
|
|
84 |
|
|
|
85 |
pointer to ''struct sysinfo'' is invalid |
|
|
86 |
!!CONFORMING TO |
|
|
87 |
|
|
|
88 |
|
|
|
89 |
This function is Linux-specific, and should not be used in |
|
|
90 |
programs intended to be portable. |
|
|
91 |
|
|
|
92 |
|
|
|
93 |
The Linux kernel has a sysinfo system call since 0.98.pl6. |
|
|
94 |
Linux libc contains a sysinfo() routine since 5.3.5, and |
|
|
95 |
glibc has one since 1.90. |
|
|
96 |
!!SEE ALSO |
|
|
97 |
|
|
|
98 |
|
|
|
99 |
proc(5) |
|
|
100 |
---- |