View | Details | Raw Unified | Return to bug 199186
Collapse All | Expand All

(-)sysutils/i7z/Makefile (-4 lines)
Lines 17-26 Link Here
17
17
18
ONLY_FOR_ARCHS=	i386 amd64
18
ONLY_FOR_ARCHS=	i386 amd64
19
19
20
# Disable scheduling flags as they cause segfaults since they are enabled at
21
# default FreeBSD optimization levels (-O2, -O3, -Os)
22
CFLAGS+=	-fno-schedule-insns2 -fno-schedule-insns -fno-caller-saves
23
24
do-install:
20
do-install:
25
	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
21
	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
26
	${INSTALL_MAN} ${WRKSRC}/doc/${PORTNAME}.man \
22
	${INSTALL_MAN} ${WRKSRC}/doc/${PORTNAME}.man \
(-)sysutils/i7z/files/patch-helper_functions.c (-12 / +43 lines)
Lines 1-5 Link Here
1
--- ./helper_functions.c.orig	2012-09-11 08:15:54.000000000 +0200
1
--- ./helper_functions.c.orig	2012-09-11 08:15:54.000000000 +0200
2
+++ ./helper_functions.c	2012-12-11 14:41:28.000000000 +0100
2
+++ ./helper_functions.c	2015-04-05 20:52:59.850869370 +0200
3
@@ -30,6 +30,11 @@
3
@@ -30,6 +30,11 @@
4
 #include <inttypes.h>
4
 #include <inttypes.h>
5
 #include <sys/types.h>
5
 #include <sys/types.h>
Lines 27-33 Link Here
27
 int Get_Bits_Value(unsigned long val,int highbit, int lowbit){ 
27
 int Get_Bits_Value(unsigned long val,int highbit, int lowbit){ 
28
 	unsigned long data = val;
28
 	unsigned long data = val;
29
 	int bits = highbit - lowbit + 1;
29
 	int bits = highbit - lowbit + 1;
30
@@ -234,7 +247,7 @@
30
@@ -92,14 +105,22 @@
31
 static inline void cpuid (unsigned int info, unsigned int *eax, unsigned int *ebx,
32
                           unsigned int *ecx, unsigned int *edx)
33
 {
34
-    unsigned int _eax = info, _ebx, _ecx, _edx;
35
-    asm volatile ("mov %%ebx, %%edi;" // save ebx (for PIC)
36
-                  "cpuid;"
37
-                  "mov %%ebx, %%esi;" // pass to caller
38
-                  "mov %%edi, %%ebx;" // restore ebx
39
-                  :"+a" (_eax), "=S" (_ebx), "=c" (_ecx), "=d" (_edx)
40
-                  :      /* inputs: eax is handled above */
41
-                  :"edi" /* clobbers: we hit edi directly */);
42
+    unsigned int _eax, _ebx, _ecx, _edx;
43
+    asm volatile (
44
+#ifdef __i386__
45
+        "pushl %%ebx\n"    // save ebx (for PIC)
46
+#else // __x86_64__
47
+        "pushq %%rbx\n"    // save rbx (for PIC)
48
+#endif
49
+        "cpuid\n"
50
+        "mov %%ebx, %1\n"  // pass to caller
51
+#ifdef __i386__
52
+        "popl %%ebx\n"     // restore ebx
53
+#else // __x86_64__
54
+        "popq %%rbx\n"     // restore rbx
55
+#endif
56
+        :"=a" (_eax), "=r" (_ebx), "=c" (_ecx), "=d" (_edx)
57
+        :"0" (info));
58
     if (eax) *eax = _eax;
59
     if (ebx) *ebx = _ebx;
60
     if (ecx) *ecx = _ecx;
61
@@ -234,7 +255,7 @@
31
     int bits;
62
     int bits;
32
     *error_indx =0;
63
     *error_indx =0;
33
 
64
 
Lines 36-42 Link Here
36
     fd = open (msr_file_name, O_RDONLY);
67
     fd = open (msr_file_name, O_RDONLY);
37
     if (fd < 0)
68
     if (fd < 0)
38
     {
69
     {
39
@@ -255,11 +268,21 @@
70
@@ -255,11 +276,21 @@
40
         }
71
         }
41
     }
72
     }
42
 
73
 
Lines 58-64 Link Here
58
 
89
 
59
     close (fd);
90
     close (fd);
60
 
91
 
61
@@ -287,7 +310,7 @@
92
@@ -287,7 +318,7 @@
62
     int fd;
93
     int fd;
63
     char msr_file_name[64];
94
     char msr_file_name[64];
64
 
95
 
Lines 67-73 Link Here
67
     fd = open (msr_file_name, O_WRONLY);
98
     fd = open (msr_file_name, O_WRONLY);
68
     if (fd < 0)
99
     if (fd < 0)
69
     {
100
     {
70
@@ -304,11 +327,21 @@
101
@@ -304,11 +335,21 @@
71
         }
102
         }
72
     }
103
     }
73
 
104
 
Lines 89-95 Link Here
89
     close(fd);
120
     close(fd);
90
     return(1);
121
     return(1);
91
 }
122
 }
92
@@ -487,10 +520,10 @@
123
@@ -487,10 +528,10 @@
93
 void Test_Or_Make_MSR_DEVICE_FILES() 
124
 void Test_Or_Make_MSR_DEVICE_FILES() 
94
 {
125
 {
95
     //test if the msr file exists
126
     //test if the msr file exists
Lines 103-109 Link Here
103
         {
134
         {
104
             //a system mght have been set with msr allowable to be written
135
             //a system mght have been set with msr allowable to be written
105
             //by a normal user so...
136
             //by a normal user so...
106
@@ -505,6 +538,7 @@
137
@@ -505,6 +546,7 @@
107
         printf ("i7z DEBUG: msr device files DONOT exist, trying out a makedev script\n");
138
         printf ("i7z DEBUG: msr device files DONOT exist, trying out a makedev script\n");
108
         if (geteuid () == 0)
139
         if (geteuid () == 0)
109
         {
140
         {
Lines 111-117 Link Here
111
             //Try the Makedev script
142
             //Try the Makedev script
112
             //sourced from MAKEDEV-cpuid-msr script in msr-tools
143
             //sourced from MAKEDEV-cpuid-msr script in msr-tools
113
             system ("msr_major=202; \
144
             system ("msr_major=202; \
114
@@ -519,6 +553,9 @@
145
@@ -519,6 +561,9 @@
115
 							");
146
 							");
116
             printf ("i7z DEBUG: modprobbing for msr\n");
147
             printf ("i7z DEBUG: modprobbing for msr\n");
117
             system ("modprobe msr");
148
             system ("modprobe msr");
Lines 121-127 Link Here
121
         } else {
152
         } else {
122
             printf ("i7z DEBUG: You DONOT have root privileges, mknod to create device entries won't work out\n");
153
             printf ("i7z DEBUG: You DONOT have root privileges, mknod to create device entries won't work out\n");
123
             printf ("i7z DEBUG: A solution is to run this program as root\n");
154
             printf ("i7z DEBUG: A solution is to run this program as root\n");
124
@@ -526,6 +563,7 @@
155
@@ -526,6 +571,7 @@
125
         }
156
         }
126
     }
157
     }
127
 }
158
 }
Lines 129-135 Link Here
129
 double cpufreq_info()
160
 double cpufreq_info()
130
 {
161
 {
131
     //CPUINFO is wrong for i7 but correct for the number of physical and logical cores present
162
     //CPUINFO is wrong for i7 but correct for the number of physical and logical cores present
132
@@ -543,6 +581,21 @@
163
@@ -543,6 +589,21 @@
133
     fclose (tmp_file);
164
     fclose (tmp_file);
134
     return atof(tmp_str);
165
     return atof(tmp_str);
135
 }
166
 }
Lines 151-157 Link Here
151
 
182
 
152
 int check_and_return_processor(char*strinfo)
183
 int check_and_return_processor(char*strinfo)
153
 {
184
 {
154
@@ -669,6 +722,7 @@
185
@@ -669,6 +730,7 @@
155
     printf("Socket-%d [num of cpus %d physical %d logical %d] %s\n",socket->socket_num,socket->max_cpu,socket->num_physical_cores,socket->num_logical_cores,socket_list);
186
     printf("Socket-%d [num of cpus %d physical %d logical %d] %s\n",socket->socket_num,socket->max_cpu,socket->num_physical_cores,socket->num_logical_cores,socket_list);
156
 }
187
 }
157
 
188
 
Lines 159-165 Link Here
159
 void construct_CPU_Heirarchy_info(struct cpu_heirarchy_info* chi)
190
 void construct_CPU_Heirarchy_info(struct cpu_heirarchy_info* chi)
160
 {
191
 {
161
     FILE *fp = fopen("/proc/cpuinfo","r");
192
     FILE *fp = fopen("/proc/cpuinfo","r");
162
@@ -715,7 +769,51 @@
193
@@ -715,7 +777,51 @@
163
     chi->max_online_cpu = it_processor_num+1;
194
     chi->max_online_cpu = it_processor_num+1;
164
     fclose(fp);
195
     fclose(fp);
165
 }
196
 }
(-)sysutils/i7z/files/patch-i7z.c (+63 lines)
Lines 1-5 Link Here
1
--- ./i7z.c.orig	2012-09-11 08:15:54.000000000 +0200
1
--- ./i7z.c.orig	2012-09-11 08:15:54.000000000 +0200
2
+++ ./i7z.c	2012-12-11 14:41:28.000000000 +0100
2
+++ ./i7z.c	2012-12-11 14:41:28.000000000 +0100
3
@@ -184,11 +184,11 @@
4
 {
5
     //below when just logging
6
     if(prog_options.logging==1) {
7
-        fprintf(fp_log_file_freq,"%d.%.9d\n",value->tv_sec,value->tv_nsec); //newline, replace \n with \t to get everything separated with tabs
8
+        fprintf(fp_log_file_freq,"%jd.%.9ld\n",(intmax_t)value->tv_sec,value->tv_nsec); //newline, replace \n with \t to get everything separated with tabs
9
     }
10
     //below when appending
11
     if(prog_options.logging==2) {
12
-        fprintf(fp_log_file_freq,"%d.%.9d\t",value->tv_sec,value->tv_nsec);
13
+        fprintf(fp_log_file_freq,"%jd.%.9ld\t",(intmax_t)value->tv_sec,value->tv_nsec);
14
     }
15
 }
16
 
17
@@ -264,20 +264,20 @@
18
     if(socket_num==0){
19
         //below when just logging
20
         if(prog_options.logging==1)
21
-            fprintf(fp_log_file_freq_1,"%d.%.9d\n",value->tv_sec,value->tv_nsec); //newline, replace \n with \t to get everything separated with tabs
22
+            fprintf(fp_log_file_freq_1,"%jd.%.9ld\n",(intmax_t)value->tv_sec,value->tv_nsec); //newline, replace \n with \t to get everything separated with tabs
23
 
24
         //below when appending
25
         if(prog_options.logging==2)
26
-             fprintf(fp_log_file_freq_1,"%d.%.9d\t",value->tv_sec,value->tv_nsec);
27
+             fprintf(fp_log_file_freq_1,"%jd.%.9ld\t",(intmax_t)value->tv_sec,value->tv_nsec);
28
     }
29
     if(socket_num==1){
30
         //below when just logging
31
         if(prog_options.logging==1)
32
-            fprintf(fp_log_file_freq_2,"%d.%.9d\n",value->tv_sec,value->tv_nsec); //newline, replace \n with \t to get everything separated with tabs
33
+            fprintf(fp_log_file_freq_2,"%jd.%.9ld\n",(intmax_t)value->tv_sec,value->tv_nsec); //newline, replace \n with \t to get everything separated with tabs
34
 
35
         //below when appending
36
         if(prog_options.logging==2)
37
-             fprintf(fp_log_file_freq_2,"%d.%.9d\t",value->tv_sec,value->tv_nsec);
38
+             fprintf(fp_log_file_freq_2,"%jd.%.9ld\t",(intmax_t)value->tv_sec,value->tv_nsec);
39
     }
40
 }
41
 
42
@@ -315,7 +315,7 @@
43
 {
44
     //below when just logging
45
     if(prog_options.logging != 0) {
46
-        fprintf(fp_log_file_Cstates,"%d.%.9d",value->tv_sec,value->tv_nsec); //newline, replace \n with \t to get everything separated with tabs
47
+        fprintf(fp_log_file_Cstates,"%jd.%.9ld",(intmax_t)value->tv_sec,value->tv_nsec); //newline, replace \n with \t to get everything separated with tabs
48
     }
49
 }
50
 
51
@@ -366,12 +366,12 @@
52
     if(socket_num==0){
53
         //below when just logging
54
         if(prog_options.logging != 0)
55
-            fprintf(fp_log_file_Cstates_1,"%d.%.9d",value->tv_sec,value->tv_nsec); //newline, replace \n with \t to get everything separated with tabs    
56
+            fprintf(fp_log_file_Cstates_1,"%jd.%.9ld",(intmax_t)value->tv_sec,value->tv_nsec); //newline, replace \n with \t to get everything separated with tabs    
57
     }
58
     if(socket_num==1){
59
         //below when just logging
60
         if(prog_options.logging != 0)
61
-            fprintf(fp_log_file_Cstates_2,"%d.%.9d",value->tv_sec,value->tv_nsec); //newline, replace \n with \t to get everything separated with tabs
62
+            fprintf(fp_log_file_Cstates_2,"%jd.%.9ld",(intmax_t)value->tv_sec,value->tv_nsec); //newline, replace \n with \t to get everything separated with tabs
63
     }
64
 }
65
 
3
@@ -386,7 +386,11 @@
66
@@ -386,7 +386,11 @@
4
 
67
 
5
 void modprobing_msr()
68
 void modprobing_msr()

Return to bug 199186