"Fossies" - the Fresh Open Source Software Archive

Member "linux_logo-6.0/libsysinfo-0.3.0/Irix/sysinfo_irix.c" (8 May 2020, 1482 Bytes) of package /linux/misc/linux_logo-6.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* sysinfo_irix.c                                                 */
    2 
    3 
    4 #include <stdio.h>
    5 #include <ctype.h>
    6 #include <unistd.h>
    7 #include <sys/stat.h>
    8 #include <sys/utsname.h>
    9 #include <string.h>
   10 
   11 #include "../sysinfo.h"
   12 #include "../include/uname.h"
   13 #include "../include/generic.h"
   14 
   15 
   16 int get_os_info(struct os_info_type *os_info) {
   17    return uname_get_os_info(os_info);
   18 }
   19 
   20 
   21    /* read from "uptime" maybe? */
   22 int get_uptime (void) {
   23 
   24    return 0;
   25 }
   26 
   27    /* read from "uptime" maybe? */
   28 void get_load_average(float *load_1,float *load_5,float *load_15) {
   29 
   30    *load_1=0.0;
   31    *load_5=0.0;
   32    *load_15=0.0;
   33    
   34 }
   35 
   36 
   37 char *get_host_name(char *hostname,char *domain) {
   38        return uname_get_host_name(hostname,domain);
   39 }
   40 
   41 long long get_mem_size(void) {
   42    
   43    FILE *fff;
   44    long long size;
   45    
   46    fff=popen("hinv -t memory","r");
   47    fscanf(fff,"%*s%*s%*s %lld",&size);
   48    pclose(fff);
   49    return size;
   50 }
   51 
   52 int get_cpu_info(struct cpu_info_type *cpu_info) {
   53 
   54    FILE *fff;
   55    
   56    /* 1 300 MHZ IP30 Processor */
   57    fff=popen("hinv","r");
   58    fscanf(fff,"%d %f",&cpu_info->num_cpus,&cpu_info->megahertz);
   59    pclose(fff);
   60    
   61    /* Cpu: MIPS R12000 */
   62    fff=popen("hinv -t cpu","r");
   63    fscanf(fff,"%*s %32s %64s",cpu_info->chip_vendor,cpu_info->chip_type);
   64    pclose(fff);
   65 
   66    cpu_info->bogomips=external_bogomips();
   67    
   68    return 0;
   69 }
   70 
   71 double get_cpu_mhz(void) {
   72    
   73       struct cpu_info_type cpu_info;
   74    
   75       get_cpu_info(&cpu_info);
   76    
   77       return (double)cpu_info.megahertz;
   78    
   79 }