"Fossies" - the Fresh Open Source Software Archive

Member "linux_logo-6.0/libsysinfo-0.3.0/README" (8 May 2020, 3279 Bytes) of package /linux/misc/linux_logo-6.0.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 libsysinfo -- by Vince Weaver <vince@deater.net>
    2 
    3 HISTORY:
    4 	This library started off as simply the sysinfo detection part
    5 	of the linux_logo program.
    6 	
    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.
   10 	
   11 	I am debating whether I should release this as a package on its
   12 	own, to be used by other programs.
   13 
   14 Theory of Operation:
   15    See the respective operating system directories for how the info is
   16    gathered.
   17    
   18    The "all" directory holds the common routines used by all os's.
   19    
   20    The "configure" file is a c-program used to determine OS/arch.  It
   21    is a hack.
   22 
   23 INTERFACE:
   24    Include the "sysinfo.h" file to get the proper defines.
   25    Link against libsysinfo
   26 
   27    [---]
   28 
   29    char *get_sysinfo_version(char *version);
   30    
   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.
   34 	
   35    [---]
   36    
   37    int get_numeric_sysinfo_version(void);
   38 
   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.
   42 
   43    [---]
   44 
   45    int get_os_info(os_info_t *os_info);
   46 
   47    typedef struct {
   48       char os_name[33]; 
   49       char os_version[33]; 
   50       char os_revision[65];
   51    } os_info_t;
   52 
   53        get_os_info() returns the above struct.  On unix-like operating
   54        systems the uname() function fills in most of this info.
   55        
   56    [---]
   57    
   58    char *get_host_name(char hostname[65],char domain[65]);
   59 
   60        Returns the hostname and filles in the domain name.  Domain name is not
   61        always guaranteed to return a proper value.
   62 
   63    [---]
   64 
   65    int get_uptime(void);
   66 
   67       Returns the number of seconds the machine has been turned on.
   68 
   69    [---]
   70    
   71    void get_load_average(float *load_1,float *load_5,float *load_15);
   72 
   73       Fills in values for the 1, 5, and 15 minute load averages.
   74 
   75    [---]
   76    
   77    int get_cpu_info(cpu_info_t *cpu_info);
   78 
   79    typedef struct {
   80       int num_cpus;
   81       float megahertz;
   82       float bogomips;
   83       char chip_vendor[33];
   84       char chip_type[64];
   85    } cpu_info_t;
   86 
   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.
   90      
   91    [---]
   92     
   93    int get_hardware_info(char hardware_string[65]);
   94   
   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.
   99 
  100 
  101    [---]
  102    
  103    long int get_mem_size(void);
  104 
  105       Returns memory size in Megabytes.  
  106       May be inaccurate on 32bit systems with >2GB of RAM.
  107       
  108    [---]   
  109 
  110    int set_cpuinfo_file(char *filename);
  111    
  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.
  114    
  115    [---]
  116    
  117    void set_pretty_printing(int value);
  118 
  119       Set whether to do pretty-printing or not.  Currently disables
  120       some, but not all, pretty-printing.