~ubuntu-branches/ubuntu/trusty/linuxlogo/trusty

« back to all changes in this revision

Viewing changes to libsysinfo-0.1.0/Linux/cpuinfo_vax.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-06-20 09:19:00 UTC
  • mfrom: (4.1.2 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080620091900-4xzuv7c7ntxvs7wt
Tags: 5.03-4
* Adding patch to fix FTBFS on s390x.
* Updating to standards 3.8.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Re-written from scratch 14 July 2002      */
2
 
/* Handles CRIS chips on Linux architecture  */
3
 
/* by Vince Weaver <vince@deater.net>        */
4
 
 
5
 
#include <stdio.h>
6
 
#include <string.h>
7
 
#include <stdlib.h>  /* atof */
8
 
 
9
 
#include "../sysinfo.h"
10
 
#include "../include/generic.h"
11
 
 
12
 
int get_cpu_info(cpu_info_t *cpu_info) {
13
 
 
14
 
    FILE *fff;
15
 
    char temp_string[256];
16
 
    char vendor_string[256],model_string[256],hardware_string[256];
17
 
    int cpu_count=0;
18
 
    float bogomips=0.0;
19
 
   
20
 
    vendor_string[0]=model_string[0]=hardware_string[0]=0;
21
 
 
22
 
       /* We get all of our info here from /proc/cpuinfo */
23
 
    if ((fff=fopen(get_cpuinfo_file(),"r") )!=NULL) {
24
 
       
25
 
       while ( (fgets(temp_string,255,fff)!=NULL) ) {
26
 
        
27
 
          if ( !(strncmp(temp_string,"cpu  ",5)) ||
28
 
               !(strncmp(temp_string,"cpu\t",4))) {
29
 
             strncpy(model_string,parse_line(temp_string),256);
30
 
             clip_lf(model_string,255);
31
 
          }
32
 
          
33
 
          
34
 
             /* Ugh why must people play with capitalization */
35
 
          if ( !(strncmp(temp_string,"bogomips",8)) ||
36
 
               !(strncmp(temp_string,"BogoMips",8)) ||
37
 
               !(strncmp(temp_string,"BogoMIPS",8))) {
38
 
             bogomips+=atof(parse_line(temp_string));
39
 
             cpu_count++;  /* Cheating way to detect number of intel CPU's */
40
 
          }
41
 
       }
42
 
    }
43
 
 
44
 
    strncpy(cpu_info->chip_vendor,"DEC",32);
45
 
    strncpy(cpu_info->chip_type,model_string,63);
46
 
   
47
 
    cpu_info->num_cpus=cpu_count;
48
 
    cpu_info->megahertz=0.0;
49
 
    cpu_info->bogomips=bogomips;
50
 
 
51
 
    return 0;
52
 
   
53
 
}
54
 
 
55
 
int get_hardware(char hardware_string[65]) {
56
 
    
57
 
    return -1;
58
 
}
59
 
 
60
 
    /* Some architectures might have better ways of detecting RAM size */
61
 
long int get_arch_specific_mem_size(void) {
62
 
       /* We have no special way of detecting RAM */
63
 
       return -1;
64
 
}