1
libsysinfo -- by Vince Weaver <vince@deater.net>
4
This library started off as simply the sysinfo detection part
5
of the linux_logo program.
7
Gradually linux_logo was split more and more between the logo
8
part and the sysinfo part. The connection ended up being
9
so small that I ended up splitting them for a cleaner interface.
11
I am debating whether I should release this as a package on its
12
own, to be used by other programs.
15
See the respective operating system directories for how the info is
18
The "all" directory holds the common routines used by all os's.
20
The "configure" file is a c-program used to determine OS/arch. It
24
Include the "sysinfo.h" file to get the proper defines.
25
Link against libsysinfo
29
char *get_sysinfo_version(char *version);
31
Returns a string with version info, such as "2.3.4". This is
32
used so programs that use libsysinfo can display what version
33
they are linked against.
37
int get_numeric_sysinfo_version(void);
39
Returns a numeric version info, like 2003004 or some such.
40
Useful so you can use a simple "if get_numeric_version() > OUR_VERSION"
41
type construct to see if a new enough libsysinfo is installed.
45
int get_os_info(os_info_t *os_info);
53
get_os_info() returns the above struct. On unix-like operating
54
systems the uname() function fills in most of this info.
58
char *get_host_name(char hostname[65],char domain[65]);
60
Returns the hostname and filles in the domain name. Domain name is not
61
always guaranteed to return a proper value.
67
Returns the number of seconds the machine has been turned on.
71
void get_load_average(float *load_1,float *load_5,float *load_15);
73
Fills in values for the 1, 5, and 15 minute load averages.
77
int get_cpu_info(cpu_info_t *cpu_info);
87
get_cpu_info() returns info on the cpus installed.
88
On Linux /proc/cpuinfo is querried to obtain this information.
89
Some "pretty-printing" is done to clean up the results a bit.
93
int get_hardware_info(char hardware_string[65]);
95
Fills in a string with extraneous hardware info.
96
This might be the machine type, or some other string.
97
On Linux this is also obtained from /proc/cpuinfo.
98
It is empty on the ix86 architecture.
103
long int get_mem_size(void);
105
Returns memory size in Megabytes.
106
May be inaccurate on 32bit systems with >2GB of RAM.
110
int set_cpuinfo_file(char *filename);
112
This is used to set the file used instead of /proc/cpuinfo.
113
I use this during debugging to point to non-native cpuinfo files.
117
void set_pretty_printing(int value);
119
Set whether to do pretty-printing or not. Currently disables
120
some, but not all, pretty-printing.